# Go Harness Profile

Use these snippets when the target project is a Go module or service.

These files are agent reference material, not automatic transformations. Merge
only the pieces that fit the target project's existing tools.

Apply this profile by priority: always preserve the target module path, generated
file boundaries, and exact local check commands; document database, auth, or
external API setup when present; consider decision records only when changing
module boundaries, persistence approach, auth flow, or external integration
policy; use a short report/check note for narrow fixes.

## Recommended Checks

- `go build ./...` to verify the module compiles.
- `go vet ./...` for static analysis included in the Go toolchain.
- `golangci-lint run` when the target project has `.golangci.yml`,
  `.golangci.yaml`, or `.golangci.toml`. Do not add golangci-lint if it is absent.
- `go test ./...` for unit tests. Add `-count=1` to disable test result caching
  when the results must reflect the current state.
- `scripts/check_docs_drift.py` for stale documentation references.
- `scripts/check_structure.py` for temporary or drift-prone files.

## Generated Files

Go projects often include code generated by tools such as `sqlc`, `protoc`,
`mockgen`, `stringer`, `templ`, or similar. These files are source: do not
edit them directly and do not omit them from version control unless the
target project policy says otherwise. Record generated paths in `AGENTS.md`
so agents know not to edit them.

If the target project has a code generation step, document the command in
`AGENTS.md` so agents can regenerate when the schema or interface changes.

## Suggested Check Script

Copy or adapt `check_harness.py` into the target repository's `scripts/`
directory when the project has no existing task runner. It runs `go vet`,
`golangci-lint` when the target has a golangci-lint config, and the generic
drift checks.

## Profile Absorption Notes

When Go is introduced after generic adoption:

- Merge relevant ignores from `gitignore.harness.txt`, especially build
  outputs, vendor directories, and the local `harness-starter-kit/` clone.
- Copy or adapt `check_harness.py` into `scripts/` only when the target has no
  equivalent local verification command.
- Update `AGENTS.md` with the module path, package layout conventions,
  generated file paths, and completion checks.
- Update `docs/conventions/coding.md` with package boundaries, error handling,
  interface definition placement, testing approach, and any project-specific
  patterns agents should repeat.
- Consider a decision record when changing or selecting the module structure,
  persistence layer, auth approach, external integration policy, or code
  generation tooling. When the task only follows the existing architecture or
  makes a narrow fix, a final report or check note is enough.
- In the final report, list which snippets were adopted, adapted, skipped, or
  deferred.

## Go Notes

- Keep `go.mod` and `go.sum` as source. Do not edit `go.sum` manually.
- Use `go mod tidy` after adding or removing dependencies.
- Do not commit build output binaries or the local `harness-starter-kit/` clone.
- Add `vendor/` to `.gitignore` unless the target project intentionally vendors
  dependencies.
- Protect generated file directories in `AGENTS.md` so agents do not overwrite
  them by hand.
- Prefer table-driven tests with `t.Run` for cases that share setup.
- Add integration or end-to-end tests only when the target project already has
  a test database, container, or emulator setup in place.
