Closed kostya-sh closed 6 years ago
Are 'testdata' directories part of the Go spec? Or how should this tool know what directories are for test data?
@weberc2, it is not part of Go language spec. This is behavior of go build tool. It is mentioned in the documentation - https://golang.org/cmd/go/#hdr-Description_of_package_lists
The only other build tool for Go that I am aware of (gb) also works the same way.
The go build tool disregard files ending with "_test.go" so a very simple code change allow for filtering out test code. Personally I am both pro and con allowing such filtering as test code is in a grey zone - should it or shouldn't it live up to same standards as "real code". Many of the go tools does not consider test code (files) to be in the same league... Regardless of perspective an option allowing to filter out "_test.go" files would be beneficial. If requested I can apply a working update (by either mail or commit)
As result it fails if there an invalid test go file in one of testdata directories