Contributing
Development Setup
Section titled “Development Setup”Requirements: Go 1.26+
git clone https://github.com/larsartmann/go-atomic-write.gitcd go-atomic-writego mod downloadBuilding
Section titled “Building”go build ./...Testing
Section titled “Testing”# Run all testsgo test ./...
# With race detectorgo test -race ./...Linting
Section titled “Linting”Uses golangci-lint with ~100 linters at their strictest defaults. Configuration lives in .golangci.yml.
# Run all configured linters — MUST exit with 0 issues before merginggolangci-lint run ./...
# Auto-fix formatting/importsgolangci-lint run ./... --fixAll pull requests must pass:
go build ./...— compiles cleanlygo test -race ./...— tests pass with race detectiongo vet ./...— no vet warningsgolangci-lint run ./...— no lint issues
Code Style
Section titled “Code Style”- Standard
testingpackage — no testify or other test utilities t.Parallel()on most testst.TempDir()for filesystem isolation- Early returns over nested conditionals
- Strong types over runtime checks
- Single-letter variables trigger
varnamelen— use full words - Inline
if errtriggersnoinlineerr— assign first, then check
Adding Dependencies
Section titled “Adding Dependencies”Adding a new third-party import requires updating the depguard.rules.main.allow list in .golangci.yml.
Pull Requests
Section titled “Pull Requests”- Ensure all tests pass:
go test -race ./... - Ensure linting passes:
golangci-lint run ./... - Add tests for new functionality
- Keep changes focused and atomic