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/build: Strange behavior with a particular file name #69722

Closed
nmittler opened this issue Sep 30, 2024 · 4 comments
Closed

x/build: Strange behavior with a particular file name #69722

nmittler opened this issue Sep 30, 2024 · 4 comments
Labels
Builders x/build issues (builders, bots, dashboards)
Milestone

Comments

@nmittler
Copy link

nmittler commented Sep 30, 2024

Go version

go version go1.23.1 darwin/arm64

Output of go env in your module/workspace:

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

What did you do?

I have a simple program that just includes a file named maintenance_windows.go.

What did you see happen?

The build seems to automatically exclude maintenance_windows.go, resulting in the build failing.

Any other name works fine.

What did you expect to see?

The file would be included in the build.

@gopherbot gopherbot added the Builders x/build issues (builders, bots, dashboards) label Sep 30, 2024
@gopherbot gopherbot added this to the Unreleased milestone Sep 30, 2024
@ianlancetaylor
Copy link
Member

A file named maintenance_windows.go is only compiled when building for Windows systems. This is documented at https://pkg.go.dev/cmd/go#hdr-Build_constraints.

If you have any further questions about this, please see https://go.dev/wiki/Questions.

@ianlancetaylor ianlancetaylor closed this as not planned Won't fix, can't repro, duplicate, stale Sep 30, 2024
@nmittler
Copy link
Author

@ianlancetaylor I just searched through the link you provided, but I don't see any direct reference to file naming or maintenance_windows.go. Can you point me a more specific location for the docs, or could we update the docs to make this more clear? Thanks!

@nmittler
Copy link
Author

Oh nm ... I see what you mean. Any file that ends with _windows will only be compiled on windows. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Builders x/build issues (builders, bots, dashboards)
Projects
None yet
Development

No branches or pull requests

4 participants