Note for the AI agent: Before running the startup script, verify that all dependencies and CLI tools are already available. If a
vendor/directory exists orgo list -m -mod=readonly allsucceeds (indicating modules are cached), you may skip the entire startup script—including allgo modcommands andgo installsteps. Otherwise, run the script as listed below.
- When adding Go tests, always invoke
t.Parallel()at the start of each test and subtest to maximize concurrency. - Prefer
github.com/gofiber/utils/v2helpers (for example,utils.Trim) when performing common operations such as string manipulation, whenever it is practical and appropriate for the surrounding code. - Keep all protocol behavior RFC-compliant (e.g., HTTP/1.1 requirements) and document any intentional deviations.
- Protect hot paths from regressions: profile changes.
- Apply secure-by-default choices (validation, timeouts, sanitization) and ensure new code hardens attack surfaces.
-
Fetch dependencies:
go mod tidy && go mod download && go mod vendor
-
Install CLI tools referenced in Makefile:
go install gotest.tools/gotestsum@latest # test runner go install golang.org/x/vuln/cmd/govulncheck@latest # vulnerability scanner go install mvdan.cc/gofumpt@latest # code formatter go install github.com/tinylib/msgp@latest # msgp codegen go install github.com/vburenin/ifacemaker@f30b6f9bdbed4b5c4804ec9ba4a04a999525c202 # interface impls go install github.com/dkorunic/betteralign/cmd/betteralign@latest # struct alignment go install golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest go mod tidy # clean up go.mod & go.sum
Use make help to list all available commands. Common targets include:
- audit: run
go mod verify,go vet, andgovulncheckfor quality checks. - benchmark: run benchmarks with
go test. - coverage: generate a coverage report.
- format: apply formatting using
gofumpt. - lint: execute
golangci-lint. - test: run the test suite with
gotestsum. - longtest: run the test suite 15 times with shuffling enabled.
- tidy: clean and tidy dependencies.
- betteralign: optimize struct field alignment.
- generate: run
go generateafter installing msgp and ifacemaker. - modernize: run golps modernize
These targets can be invoked via make <target> as needed during development and testing.
- PR titles must start with a category prefix describing the change:
🐛 bug:,🔥 feat:,📒 docs:, or🧹 chore:. - Generated PR titles and bodies must summarize the entire set of changes on the branch (for example, based on
git log --oneline <base>..HEADor the full diff), not just the latest commit. The Summary section should reflect all modifications that will be merged.
Before presenting final changes or submitting a pull request, run each of the following commands and ensure they succeed. Include the command outputs in your final response to confirm they were executed:
make audit
make generate
make betteralign
make modernize
make format
make lint
make testAll checks must pass before the generated code can be merged.
After completing the programmatic checks above, confirm that any relevant documentation has been updated to reflect the changes made, including PR instructions when applicable.