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

incorrect-looking // +build lines #1

Open
rsc opened this issue Mar 31, 2020 · 0 comments
Open

incorrect-looking // +build lines #1

rsc opened this issue Mar 31, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@rsc
Copy link

rsc commented Mar 31, 2020

I've been analyzing // +build usage in the Go ecosystem and turned up internal/cpu/init.go, which says:

// +build 386 !gccgo,amd64 !gccgo,amd64p32 !gccgo

It looks like the intent here was "(386 && !gccgo) || (amd64 && !gccgo) || (amd64p32 && !gccgo)",
but the meaning is "386 || (!gccgo && amd64) || (!gccgo && amd64p32) || !gccgo",
or equivalently "386 || !gccgo".

There are two ways to write the presumed intent. As one line:

// +build 386,!gccgo amd64,!gccgo amd64p32,!gccgo

or as two lines:

// +build 386 amd64 amd64p32
// +build !gccgo

Best,
Russ

@zchee zchee added the bug Something isn't working label Jul 3, 2020
@zchee zchee self-assigned this Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants