mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
d67925f5a1
Running `mage check` takes too long time for user (and agent) iterations. That will eventualy run on CI. This is a faster version that: * Checks gofmt. * Runs go vet. * Runs staticcheck. * Runs unit tests without the race flag. It assumes that Go is installed, but will check if staticcheck is available and install it if not with go install. It takes an optional argument to specify packages to check, otherwise it checks all packages. This commit also enable local runs of the image golden tests.
15 lines
748 B
Markdown
15 lines
748 B
Markdown
* Brevity is good.
|
|
* Assume that the maintainers and readers of the code you write are Go experts:
|
|
* Don't use comments to explain the obvious.
|
|
* Use self-explanatory variable and function names.
|
|
* Use short variable names when the context is clear.
|
|
* If you need to add temporary debug printing, use `hdebug.Printf`.[^1]
|
|
* Never export symbols that's not needed outside of the package.
|
|
* Avoid global state at (almost) all cost.
|
|
* This is a project with a long history; assume that a similiar problem has been solved before, look hard for helper functions before creating new ones.
|
|
* Use `./check.sh ./somepackage/...` when iterating.
|
|
* Use `./check.sh` when you're done.
|
|
|
|
|
|
[^1]: CI build fail if you forget to remove the debug printing.
|