Skip to content

proposal: cmd/go: allow && and || operators and parentheses in build tags #25348

@mundaym

Description

@mundaym

The review for CL 107628 reminded me of this idea,so I wanted to make a quick note of it.

I think that this:

// +build (!arm64 && !s390x) || (arm64 && !go1.11) || gccgo || appengine

Would be a lot easier for a Go developer to parse (and verify) than the current syntax we use for build tags:

// +build !arm64,!s390x arm64,!go1.11 gccgo appengine

Build tags are hard to test so we should make them as easy to review as possible.

This might be a Go 2 suggestion, but it could probably also be added to Go 1. For Go 2 I would also be tempted to remove multi-line build tags which are also difficult for Go developers to parse.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions