Add CONTRIBUTING.md for testing, PR checks, and release-please flow; link from README and AGENTS. Document envc bash sourcing (set -a, source <(...)) for YAML/INI. Co-authored-by: Cursor <cursoragent@cursor.com>
2.7 KiB
Contributing to go-config
Thank you for helping improve this module. This document covers testing expectations, local checks, and how releases are cut (so nobody tags or edits versions by hand).
For repository purpose, public API notes, and agent-oriented context, see AGENTS.md.
Testing policy
This project follows the eSlider no synthetic mocks policy (see .cursor/rules/no-synthetic-mocks.mdc):
- Unit tests — pure inputs for merge, keymap, structconv, env flat-map helpers.
httptest— allowed only to test our HTTP client behaviour ininternal/source(not third-party API emulation).- Fixtures — real files under
fixtures/;testfixturesresolves paths from module root.
Before you open a pull request
Run the same checks CI will run (adjust paths if your checkout layout differs):
go mod tidy
go vet ./...
go test -race -shuffle=on -count=1 ./...
golangci-lint run --timeout 5m
Commit messages
Use Conventional Commits (feat:, fix:, perf:,
feat!: or BREAKING CHANGE: for breaking changes, etc.). Release automation reads these
messages to choose the next SemVer.
Release and versioning
Versions are computed from git history, not edited in Go source. Do not create release tags manually or bump version constants in code.
CI on every change
- Every push and pull request runs
test.yml(matrix: Go 1.22, 1.23, stable × linux / macOS / windows, with-race -shuffle=on) andlint.yml(go vet+golangci-lint).
Release Please and GoReleaser
-
On pushes to
main,release-please.ymlparses commits since the last tag and opens (or updates) a release pull request that bumpsCHANGELOG.mdand.release-please-manifest.jsonto the next SemVer. -
Merging that release PR creates the git tag
vX.Y.Zand a GitHub Release. -
The tag triggers
release.yml, which runs GoReleaser to cross-compile theenvcbinary (linux / darwin / windows × amd64 / arm64), injects-X main.version={{.Version}}(and related ldflags) at link time, and attaches archives pluschecksums.txtto the release.
Local go install builds of envc report dev for envc version unless you pass your own
-ldflags; release binaries show the released version.
Architecture decisions
Repo-local ASRs: docs/asr/README.md. Broader eSlider Go module
conventions: inventar/docs/asr/ASR-0008.md (see AGENTS.md — Related).