Skip to content

x/text/message: does gotext extract variable that starts with "msg"? #66128

@bigguaxxx

Description

@bigguaxxx

Go version

go version go1.18.10 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE="on"
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/xzp/Library/Caches/go-build"
GOENV="/Users/xzp/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/xzp/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/xzp/go"

What did you do?

I defined a global variable that starts with "msg" in main.go, but it is not being called by message.printer. When I execute the gotext extraction, the result unexpectedly extracts this variable into the translation document.
var msgEnv string = "idc"

What did you see happen?

➜ awesomeProject9 go generate ./translations/translations.go
en: Missing entry for "msgEnv".

What did you expect to see?

msgEnv not be extracted

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions