go/build: Context.BuildTags are ignored when checking file name #25461
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
When
Context.BuildTags
has "freebsd" in it, go/build should include Go files for FreeBSD. However, it fails to include Go files with freebsd in the name when GOOS is not freebsd. It works as expected when "freebsd" is in// +build
line but not in file name.What version of Go are you using (
go version
)?go version go1.10.1 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GORACE=""
GOTMPDIR=""
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/m6/vs051rl54k3_sgxr94ylcz5h0000gn/T/go-build595956365=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
git clone git@github.com:linzhp/go_examples.git
cd go_examples/buildConstraints
go run main.go
What did you expect to see?
[print_freebsd.go print.go]
What did you see instead?
[print.go]
The text was updated successfully, but these errors were encountered: