-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed as duplicate of#73294
Closed as duplicate of#73294
Copy link
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.
Description
Go version
go version go1.25.1 linux/amd64
Output of go env
in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v3'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/gopher/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/gopher/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2805719706=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/gopher/amd64v3test/go.mod'
GOMODCACHE='/home/gopher/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/gopher/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/gopher/sdk/go1.25.1'
GOSUMDB='sum.golang.org'
GOTELEMETRY='on'
GOTELEMETRYDIR='/home/gopher/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/gopher/sdk/go1.25.1/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25.1'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
- Use
go env -w GOAMD64=v3
to set theGOAMD64
env value user-wide. - Checked that
go env GOAMD64
showsv3
. (Also in fullgo env
output) - Created a file requiring the amd64.v3 build constraint:
//go:build amd64.v3
// +build amd64.v3
package main
import "fmt"
func main() {
fmt.Println("GOAMD64=v3: available")
}
- Run
go build
(or any other command that respects build tags)
What did you see happen?
The toolchain acts as though the GOAMD64
variable wasn't set resulting in the amd64.v3
constraint not being satisfied, excluding the file from the build. When it's the only file:
$ go build
package amd64v3test: build constraints exclude all Go files in /home/gopher/amd64v3test
What did you expect to see?
I expected to see a successful build that includes the file. It does work if the GOAMD64
environment variable is set in the shell, suggesting I got the build constraint and syntax correct:
$ GOAMD64=v3 go build
// Successful build
Similarly looking at go list -json
shows such files are ignored when the value is set using the config file, but not when set by the environment.
I only tested GOAMD64
, but I suspect it may also affect other "subarch" style build constraints (like GOARM
).
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.