mmcloughlin / avo

Generate x86 Assembly with Go
BSD 3-Clause "New" or "Revised" License
2.73k stars 89 forks source link

Avo needs GOARCH to be set to find build-tagged stubs #450

Open FiloSottile opened 1 week ago

FiloSottile commented 1 week ago

If you use Package and Implements calls to implement a stub, and the stub is only in a file tagged _amd64.go, generation will fail if run on e.g. darwin/arm64.

This can be worked around by simply adding the following two lines to main().

os.Setenv("GOOS", "linux")
os.Setenv("GOARCH", "amd64")

This is mostly an annoyance, but it could led to incorrect code being generated if a function with the same name but with different types is defined in a non-amd64 file which matches the host.