Navigation Menu

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: go tool compile no longer rejects invalid GOOS/GOARCH combinations #43103

Closed
ALTree opened this issue Dec 9, 2020 · 2 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Dec 9, 2020

Consider the following:

$ cat test.go

package main

func main() {
	println("hi!")
}
$ go version
go version go1.15.6 linux/amd64

$ GOOS=linux GOARCH=wasm go build test.go
cmd/go: unsupported GOOS/GOARCH pair linux/wasm

$ GOOS=linux GOARCH=wasm go tool compile test.go
cmd/go: unsupported GOOS/GOARCH pair linux/wasm


$ gotip version
go version devel +854a2f8e01 Wed Dec 9 03:06:41 2020 +0000 linux/amd64

$ GOOS=linux GOARCH=wasm gotip build test.go
cmd/go: unsupported GOOS/GOARCH pair linux/wasm
$ GOOS=linux GOARCH=wasm gotip tool compile test.go
$ # no error, an object file is written to disk

$ file test.o
test.o: current ar archive

$ strings test.o | head -n3
!<arch>
__.PKGDEF       0           0     0     644     132       `
go object linux wasm devel +854a2f8e01 Wed Dec 9 03:06:41 2020 +0000 X:none

This seem to happen for every invalid combination, for example:

$ GOOS=windows GOARCH=arm64 go tool compile test.go
cmd/go: unsupported GOOS/GOARCH pair windows/arm64

$ GOOS=windows GOARCH=arm64 gotip tool compile test.go
$ strings test.o | head -n3
!<arch>
__.PKGDEF       0           0     0     644     135       `
go object windows arm64 devel +854a2f8e01 Wed Dec 9 03:06:41 2020 +0000 X:none

It appears this was introduced in CL 236563. Is this intentional?

cc @jayconrod @bcmills @matloob

@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 9, 2020
@ALTree ALTree added this to the Go1.16 milestone Dec 9, 2020
@bcmills
Copy link
Contributor

bcmills commented Dec 9, 2020

Yes, this is intentional for #24398: the go command doesn't need to verify the GOOS/GOARCH combination unless it needs to use that combination to determine other information (such as default and supported buildmodes and linkmodes).

@ALTree
Copy link
Member Author

ALTree commented Dec 9, 2020

Okay, thanks. We can close then (unless you think this should be documented and want to track that).

@bcmills bcmills closed this as completed Dec 9, 2020
@golang golang locked and limited conversation to collaborators Dec 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants