From: Anderson A. Giacomolli Date: Mon, 9 Nov 2026 21:17:23 +0000 (-0300) Subject: Name the tools that check the Go rules X-Git-Url: https://git.giacomolli.uk/onechat/commitdiff_plain/39d1a3fd09f8255298590b4413115ae72e0e3928?ds=sidebyside;hp=522d7fd117285e4e4ce3ea5ec9b5a1722521b681 Name the tools that check the Go rules The skills identify the linters that enforce error, assertion, name, and spacing rules. They keep manual review for logical groups, local error paths, and the config exceptions because passing lint does not prove those rules. --- diff --git a/.agents/skills/check/SKILL.md b/.agents/skills/check/SKILL.md index 4dff349..e920bc3 100644 --- a/.agents/skills/check/SKILL.md +++ b/.agents/skills/check/SKILL.md @@ -11,7 +11,10 @@ Run every command in the Nix development shell. Use ## Procedure 1. Format all files with `bin/format`. -2. Run the checks with `bin/check`. +2. Run the checks with `bin/check`. Its golangci-lint config keeps the + standard linters and adds `errorlint`, `gocritic`, `testifylint`, + `revive`, `wrapcheck`, `nlreturn`, and `wsl_v5`. The settings in + `.golangci.yml` match the Go rules. 3. Run `git add` on new files, then run `nix build` and `nix flake check`. 4. Fix every failure and run the steps again. Do not disable a linter or diff --git a/.agents/skills/go-code/SKILL.md b/.agents/skills/go-code/SKILL.md index 3d9e3f3..086360a 100644 --- a/.agents/skills/go-code/SKILL.md +++ b/.agents/skills/go-code/SKILL.md @@ -22,7 +22,8 @@ description: Go style rules. Use before you write or review Go code. - Write type names with a capital letter, so that a variable can have the name of its type. Write all other package-level names in lower case. -- Write all the letters of an initialism in one case. +- Write all the letters of an initialism in one case. `revive` checks + common initialisms. - Put entry points first, then each struct's methods as a group, then standalone utility functions. Do not put a utility function between the methods of one type. @@ -47,9 +48,12 @@ description: Go style rules. Use before you write or review Go code. different variable only to keep or join errors. - Use `errors.Is` and `errors.As` to examine errors. Do not compare an error directly with a sentinel, because errors can be wrapped. + `errorlint` checks comparisons and type assertions on errors. - When a function has more than one error path, wrap each returned error with the context of its operation. A function with one error path can - return the error directly. + return the error directly. `wrapcheck` checks package and interface + calls, with the exceptions in `.golangci.yml`. Review local calls and + the number of error paths by hand. - When deferred cleanup can fail, use a named `err` result and join the cleanup error with `errors.Join`. @@ -68,7 +72,8 @@ description: Go style rules. Use before you write or review Go code. - Put an empty line between logical blocks, also after multiline declarations, assignments, literals, and calls. Keep an operation with its immediate error or result check. Keep a short declaration with its - immediate use. + immediate use. `wsl_v5` and `nlreturn` check part of this rule. Review + the remaining logical blocks and immediate-use groups by hand. - Use GNU-style command flags: two dashes for long flags, such as `--cwd`, and one dash only for one-letter flags, such as `-h`. - Prefer the Go standard library. Prefer Go over cgo. @@ -86,7 +91,8 @@ description: Go style rules. Use before you write or review Go code. - Add tests for meaningful behavior. Do not add tests that only repeat implementation details. -- Use `testify/require` for assertions. +- Use `testify/require` for assertions. `testifylint` checks the + assertion forms. - Name a table-driven case slice `testCases` and its range variable `tc`. A subtest name describes the behavior, not a generic outcome or input.