golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.02k stars 17.68k forks source link

cmd/build: wrong error on misspelled GOOS #21999

Closed dvyukov closed 7 years ago

dvyukov commented 7 years ago

go version devel +39983cf491 Wed Sep 20 18:11:52 2017 +0000 linux/amd64

package has 2 files: test_linux.go

package test

and test_windows.go:

package test
$ GOOS=windwos go build ./test
can't load package: package test: build constraints exclude all Go files in /gopath/test

should say:

$ GOOS=windwos go build ./test
cmd/go: unsupported GOOS/GOARCH pair windwos/amd64
mvdan commented 7 years ago

This seems to be because the build constraints error is thrown when loading a package, whereas the GOOS/GOARCH one is thrown when trying to build it.

gopherbot commented 7 years ago

Change https://golang.org/cl/65656 mentions this issue: cmd/go: move GOOS/GOARCH and tags checks to Init