Middle · Go with coding agents

Codex repository guidance for Go

What should a Go repository put in AGENTS.md for Codex?

Try explaining this aloud before opening the answer. State your assumptions and trace a boundary case.

EXAMPLE · FRAGMENT UNLESS A COMPLETE PROGRAM IS SHOWN

text
# Repository guidance example (AGENTS.md)
# Go version: use the version declared by the repository.
# Unit checks: go test ./...
# Concurrency changes: go test -race ./internal/worker/...
# Integration: use isolated test services; see docs/testing.md.
Reveal a strong answer
  1. Record the repository layout, exact setup/test/build commands, supported Go version, code-generation steps and relevant package boundaries. Keep instructions concise and specific enough to act on.

  2. Codex discovers repository guidance by directory scope, with documented override/fallback rules. Do not assume an instruction file outside the discovered scope applies; verify what was read when debugging inconsistent behavior.

  3. Describe how to verify concurrency, migration and dependency changes, and where secrets must come from without including their values. Instructions are context; actual sandbox/approval controls enforce permissions and must be configured separately.

Common trap

A sentence saying “never read secrets” is not a technical access-control boundary.

Try it

Write guidance for a Go HTTP service whose integration tests need a local MongoDB.

Worked solution

Name the unit-test command, the opt-in integration command, isolated fixture setup and cleanup, required environment variable names and a prohibition on production endpoints. Require checking transaction/cancellation behavior for relevant changes. Never put the connection password in the file.

Change the constraint

How would a nested package instruction override a repository-wide convention?

How did you do?

Self-assessment, not a compiler pass or interview score. Explain the reasoning unaided before marking understood.

Not marked. Progress stays on this browser, separate from course completion.

Primary references

Checked 2026-10-20. Use documentation for your pinned runtime, driver and tool version.