//go build fails boolean conditions

My code should support many types of OSs and archs.

Im using a netstat supporting lib ("github.com/cakturk/go-netstat/netstat") which is supported for windows and linux but not for darwin or arm64 arch.

I have 2 files to handle this issue packaged as netstatSafe. one that is marked with //go:build !darwin && !arm64 that utilizes netstat logics, and another thats marked with //go:build darwin || arm64, that only imports the “errors” package and has no logic other than returning an error that netstat isnt suported.

However - when running GOOS=windows GOARCH=arm64 go build - my build fails with:

package SomeService
    imports SomeService/myLib1
    imports SomeService/myLib2
    imports MyInfra/netstatSafe: build constraints exclude all Go files in path/to/netstatSafe

The boolean conditions seem correct so I feel puzzled. When i created a few files with windows && !arm64 + linux && !arm64 + darwin && !arm64 + arm64 it worked - but this is not what the poet has meant - im sure.

Also tried go clean -modcache but it didn’t help
Would appreciate any assistance

Hello there, shouldn’t you pass a build tag with -tags flag?

Hello again. Can you provide the exact error text on failed build? And some more info on your project structure or/and code?

hi, this is all that i can share - and really - all that there is to it. i assume its a bug.

It’s hard to tell without the code. I managed to build it without problems and tags worked as expected.