Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/text/language: Matcher returns Arabic with No confidence instead of falling back to first language #63330

Open
iandees opened this issue Oct 2, 2023 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@iandees
Copy link

iandees commented Oct 2, 2023

What version of Go are you using (go version)?

$ go version
go version go1.21.0 darwin/arm64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/idees/Library/Caches/go-build'
GOENV='/Users/idees/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/idees/redacted/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/idees/redacted/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.21.0/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.21.0/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='redacted'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/l1/mykxjxqx4sggl2dq3144wcym0000gn/T/go-build2246364886=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

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.

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 of No.

@iandees iandees changed the title golang.org/x/text/language: Matcher returns Ararbic with No confidence instead of falling back to first language golang.org/x/text/language: Matcher returns Arabic with No confidence instead of falling back to first language Oct 2, 2023
@seankhliao seankhliao changed the title golang.org/x/text/language: Matcher returns Arabic with No confidence instead of falling back to first language x/text/language: Matcher returns Arabic with No confidence instead of falling back to first language Oct 2, 2023
@gopherbot gopherbot added this to the Unreleased milestone Oct 2, 2023
@prattmic
Copy link
Member

prattmic commented Oct 3, 2023

cc @mpvl

@prattmic prattmic added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants