Hi, happy new year y'all! I just want to make sure of something, probably 
it's just a boolean question (yes/no).

I've been working on a project where all test files are declaring a build 
constraint at the first line, like the ones below:

// +build unit
or
// +build integration

When I run the tests with `go test ./...`, I receive the message that there 
are no test files found; but, if I run `go test -tags integration,unit 
./...`, then the tests are finally executed. Therefore, if I want to run 
the test base, I have to inform these constraints.

My question is: is it correct to assume that, in a test base where all 
files are using build constraints, we have to inform these tags when 
running tests, and if don't, the command cannot find any test files, 
despite the fact if they are executable or not, is that right?

I've read the docs for https://pkg.go.dev/go/build 
and https://pkg.go.dev/cmd/go#hdr-Build_constraints but I couldn't find 
anything explicitly related to test execution. I believe it behaves this 
way based on what I've read 
here https://mickey.dev/posts/go-build-tags-testing/ .

Thanks in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1daef90c-0700-45c5-826a-eaf3d43f1ec6n%40googlegroups.com.

Reply via email to