Consider using stdlib's testing's executable examples instead of a standalone example/main.go
josharian opened this issue · 1 comments
josharian commented
This has a few advantages:
- It helps prevent accidental breakages like #10, particularly with help from CI such as travis.
- It integrates nicely with godoc.
- Having the expected output in the example helps the reader. (Had there been expected output in
main.go
, I would very likely have filed a PR to fix #10 instead of filing it as an issue, but I don't know what the intention of the example is.) - When others vendor your library,
go build ./...
doesn't accidentally generate unneeded executables.
tylerstillwater commented
I agree. We should do this, @matryer