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

cmd/go: unable to build package which references identifiers in file named update_linux.go #71445

Closed
joelklint opened this issue Jan 26, 2025 · 2 comments
Labels
BugReport Issues describing a possible bug in the Go implementation.

Comments

@joelklint
Copy link

Go version

go version go1.23.3 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/firefox/Library/Caches/go-build'
GOENV='/Users/firefox/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/firefox/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/firefox/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.23.3/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.23.3/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.3'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/firefox/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/firefox/git/personal/golang-filename-update-linux/go.mod'
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/1h/b9zf9dwx6ts9941yxfllt_b00000gn/T/go-build4286075515=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Create a file named update_linux.go in a package. Create a constant in that file. Reference that constant from another file within the same package. Now build the package by using a shell to navigate to the folder of the package and invoking go build .

Repo with reproducible example: https://github.com/joelklint/golang-filename-update-linux

What did you see happen?

Command invocation

go build .

stdout

# example.com/example
./main.go:4:10: undefined: msg

Exit code

1

What did you expect to see?

Command invocation

go build .

stdout

Exit code

0
@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Jan 26, 2025
@seankhliao
Copy link
Member

https://pkg.go.dev/cmd/go#hdr-Build_constraints

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation.
Projects
None yet
Development

No branches or pull requests

3 participants