|
| 1 | +# Go Harness Profile |
| 2 | + |
| 3 | +Use these snippets when the target project is a Go module or service. |
| 4 | + |
| 5 | +These files are agent reference material, not automatic transformations. Merge |
| 6 | +only the pieces that fit the target project's existing tools. |
| 7 | + |
| 8 | +Apply this profile by priority: always preserve the target module path, generated |
| 9 | +file boundaries, and exact local check commands; document database, auth, or |
| 10 | +external API setup when present; consider decision records only when changing |
| 11 | +module boundaries, persistence approach, auth flow, or external integration |
| 12 | +policy; use a short report/check note for narrow fixes. |
| 13 | + |
| 14 | +## Recommended Checks |
| 15 | + |
| 16 | +- `go build ./...` to verify the module compiles. |
| 17 | +- `go vet ./...` for static analysis included in the Go toolchain. |
| 18 | +- `golangci-lint run` when the target project has `.golangci.yml`, |
| 19 | + `.golangci.yaml`, or `.golangci.toml`. Do not add golangci-lint if it is absent. |
| 20 | +- `go test ./...` for unit tests. Add `-count=1` to disable test result caching |
| 21 | + when the results must reflect the current state. |
| 22 | +- `scripts/check_docs_drift.py` for stale documentation references. |
| 23 | +- `scripts/check_structure.py` for temporary or drift-prone files. |
| 24 | + |
| 25 | +## Generated Files |
| 26 | + |
| 27 | +Go projects often include code generated by tools such as `sqlc`, `protoc`, |
| 28 | +`mockgen`, `stringer`, `templ`, or similar. These files are source: do not |
| 29 | +edit them directly and do not omit them from version control unless the |
| 30 | +target project policy says otherwise. Record generated paths in `AGENTS.md` |
| 31 | +so agents know not to edit them. |
| 32 | + |
| 33 | +If the target project has a code generation step, document the command in |
| 34 | +`AGENTS.md` so agents can regenerate when the schema or interface changes. |
| 35 | + |
| 36 | +## Suggested Check Script |
| 37 | + |
| 38 | +Copy or adapt `check_harness.py` into the target repository's `scripts/` |
| 39 | +directory when the project has no existing task runner. It runs `go vet`, |
| 40 | +`golangci-lint` when the target has a golangci-lint config, and the generic |
| 41 | +drift checks. |
| 42 | + |
| 43 | +## Profile Absorption Notes |
| 44 | + |
| 45 | +When Go is introduced after generic adoption: |
| 46 | + |
| 47 | +- Merge relevant ignores from `gitignore.harness.txt`, especially build |
| 48 | + outputs, vendor directories, and the local `harness-starter-kit/` clone. |
| 49 | +- Copy or adapt `check_harness.py` into `scripts/` only when the target has no |
| 50 | + equivalent local verification command. |
| 51 | +- Update `AGENTS.md` with the module path, package layout conventions, |
| 52 | + generated file paths, and completion checks. |
| 53 | +- Update `docs/conventions/coding.md` with package boundaries, error handling, |
| 54 | + interface definition placement, testing approach, and any project-specific |
| 55 | + patterns agents should repeat. |
| 56 | +- Consider a decision record when changing or selecting the module structure, |
| 57 | + persistence layer, auth approach, external integration policy, or code |
| 58 | + generation tooling. When the task only follows the existing architecture or |
| 59 | + makes a narrow fix, a final report or check note is enough. |
| 60 | +- In the final report, list which snippets were adopted, adapted, skipped, or |
| 61 | + deferred. |
| 62 | + |
| 63 | +## Go Notes |
| 64 | + |
| 65 | +- Keep `go.mod` and `go.sum` as source. Do not edit `go.sum` manually. |
| 66 | +- Use `go mod tidy` after adding or removing dependencies. |
| 67 | +- Do not commit build output binaries or the local `harness-starter-kit/` clone. |
| 68 | +- Add `vendor/` to `.gitignore` unless the target project intentionally vendors |
| 69 | + dependencies. |
| 70 | +- Protect generated file directories in `AGENTS.md` so agents do not overwrite |
| 71 | + them by hand. |
| 72 | +- Prefer table-driven tests with `t.Run` for cases that share setup. |
| 73 | +- Add integration or end-to-end tests only when the target project already has |
| 74 | + a test database, container, or emulator setup in place. |
0 commit comments