I want to create a package in Go with tests and examples for the package as subdirectories to keep the workspace cleaner. Is this possible and if so how?
All the docume
Put your tests alongside your code in the same directory in a file called file_test.go
where "file" is the name of the source code file you're testing. This is convention and I've found it to be best in my own experience.
If the go test
tool isn't quite automated enough for you, you might look into GoConvey, which has a web UI that will automatically update and run traditional Go tests as well as GoConvey tests (which are based on behavior, and are more self-documenting than traditional Go tests).