'gomod, Which folders/files will be excluded?

Golang use gomod, Some floder/files will be excluded. Such as example/include floder and *_test.go type file.

So, What are all the rules?



Solution 1:[1]

The Go tool documentation says:

Files in package documentation are ignored by the go command.

and

Directory and file names that begin with "." or "_" are ignored by the go tool, as are directories named "testdata".

Additionally, the documentation for the build command says:

When compiling packages, build ignores files that end in '_test.go'.

Build constraints can also be used to ignore files.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1