Permalink
Browse files

Bugfix: use returned index, tags don’t necessarily match

See golang/go#24211 for more details

This hit us for a zh_CN manpage with precisely one "en" option: the returned tag
is en-u-rg-chzzzz, not en.
  • Loading branch information...
stapelberg committed Aug 5, 2018
1 parent cb414bd commit cf71a68cc46d96fc9908179223a9c10e62c5e0cf
Showing with 2 additions and 8 deletions.
  1. +2 −8 cmd/debiman/rendermanpage.go
@@ -204,14 +204,8 @@ func bestLanguageMatch(current *manpage.Meta, options []*manpage.Meta) *manpage.
// improves cross-references.

matcher := language.NewMatcher(tags)
tag, _, _ := matcher.Match(current.LanguageTag)
for idx, t := range tags {
if t == tag {
return options[idx]
}
}
// unreached
return nil
_, idx, _ := matcher.Match(current.LanguageTag)
return options[idx]
}

type byLanguage []*manpage.Meta

0 comments on commit cf71a68

Please sign in to comment.