1

I have many classes of test, which are marked with build constraints, e.g.:

//go:build all || (!foo && !bar && !baz && quux)

for the test class quux. This is okay, as far as it goes, but what I'd really rather have is constraints such that the class quux runs for these commands (in the correct directory):

$ go test
$ go test ./...
$ go test ./... -tags quux

but not for

$ go test ./... tags foo

The actual list of test classes is twenty-plus, so

//go:build all || quux || (!foo && !bar && !baz &&...

is not a good option. If there's some way to set the default value of -tags, so that running go test ./... without explicitly passing a -tags argument defaults to -tags all (or even if that's possible but only for bare go test rather than with ./...), that would be good enough.

4
  • There are never no build tags, because every build has implicit tags provided for OS & arch. Commented Sep 29, 2022 at 18:01
  • I'm aware. That's not relevant. Commented Sep 29, 2022 at 18:33
  • 1
    Then perhaps you should edit your question, which currently reads "Go build constraints to run if none set". The scenario "if none set" is not possible. Commented Sep 29, 2022 at 19:09
  • No, it's correct as stated. Commented Sep 29, 2022 at 19:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.