Skip to content

incorrect-looking // +build lines #1

@rsc

Description

@rsc

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions