Go Modern Guidelines is a reference resource that helps AI coding agents write modern Go code.
The repository addresses two problems that cause coding agents to generate outdated Go: training data lag, where models lack knowledge of recently added language features, and frequency bias, where agents favor older patterns that appear more often in training data. The guidelines cover language features and standard library additions from Go 1.0 through Go 1.27, enabling agents to detect a project's Go version from go.mod and use only the idioms and functions available in that version. Examples include preferring max(a, b) over if-else blocks, slices.Contains over manual loops, and cmp.Or for nil checks, along with newer additions like pointer creation with new(42) and type-safe error matching with errors.AsType[T].
The tool is designed for teams using AI coding agents like Junie, Claude Code, Codex, or Cursor who want those agents to generate code aligned with current Go best practices. It suits any project where maintaining modern Go idioms matters, particularly those targeting recent Go versions. The guidelines align with the Go team's modernize analyzer, which automatically updates existing code to newer patterns; these guidelines serve the same goal for newly generated code, reducing the need for post-generation fixes.
The project maintains active integrations across multiple AI coding platforms, with installation mechanisms that automatically fetch a compatible Go toolchain on first use and store it in a local cache without modifying the project itself. The guidelines are kept current with each Go release, covering features up through the latest stable version.