Testing and documenting Code¶
In go you place your tests directly in the package. You can simply use the standard go testing tool.
To run tests of a certain package simply run the
go test tool.
go test -v flamingo.me/flamingo/v3/framework/config
Also, we want to provide a useful
go doc api documentation. Therefore, stick to the go doc conventions.
Read more here: blog.golang.org/godoc-documenting-go-code
- Go doc conventions: blog.golang.org/godoc-documenting-go-code.
- Prefer to do "blackbox" tests and append
_testto the package name in your test files.
Example*test functions where it is useful to show examples.
- Add a
doc.goin case you want to provide a documentation for the package, and it doesn't fit anywhere else.
Flamingo Module documentation¶
Each module should have a Readme.md file in its root:
- The first line should be a h1 headline with the Title of the module e.g.
# Cart Module
- This will show up in the rendered documentation as page title as well
- Any other headline should at least be h2
## Subheadlinein order to show up in the generated table of content later.