I have a language.Matcher built with an array of languages. According to the doc for NewMatcher, "The first element is used as the default value in case no match is found" so I expected language.English to be returned for a language that was not added to the matcher. For example, when I pass in the parsed pa-PK, I get language.Arabic with a confidence enum of No.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I have a
language.Matcher
built with an array of languages. According to the doc forNewMatcher
, "The first element is used as the default value in case no match is found" so I expectedlanguage.English
to be returned for a language that was not added to the matcher. For example, when I pass in the parsedpa-PK
, I getlanguage.Arabic
with a confidence enum ofNo
.https://go.dev/play/p/qjnoDk9kXXM
What did you expect to see?
I expected a match to
language.English
, the default language in the matcher.What did you see instead?
I get
language.Arabic
with a confidence enum ofNo
.