JetBrains Open-Sources go-modern-guidelines: Teaching AI to Write Modern Go Code

JetBrains open-sources guidelines to teach AI assistants how to write modern, idiomatic Go code.
JetBrains has released go-modern-guidelines, an open-source project that provides structured, machine-friendly guidelines to help AI coding assistants generate modern Go code. The project addresses the common problem of AI tools producing outdated patterns by covering Go's latest features including generics, log/slog structured logging, modern error handling, and new loop syntax. Already earning 2,200+ GitHub stars, it reflects the growing trend of context engineering in AI-assisted development.
When AI Meets Go: An Overlooked Pain Point
As AI coding assistants like GitHub Copilot, Cursor, and Claude Code become mainstream, more and more developers rely on AI to write production code. But a subtle problem is emerging: AI models are often trained on outdated data, causing them to generate code that uses stale patterns and doesn't follow the language's latest best practices.
The root cause lies in the underlying architecture of AI coding assistants. These tools are fundamentally built on large language models (LLMs), and an LLM's knowledge comes from the code corpus used during training. Training data typically has a "knowledge cutoff" — language features, standard library updates, and community best practices released after that date are unknown to the model. Even though some tools use retrieval-augmented generation (RAG) or continuous fine-tuning to mitigate this, the results remain limited — especially for "soft knowledge" like coding style and idiomatic usage, where models update far too slowly to keep pace with the language's own evolution.
Go is particularly affected. The language has evolved rapidly over the past few years — from generics (Go 1.18) to built-in min/max/clear functions (Go 1.21), to for range support for integers (Go 1.22) and the introduction of structured logging with log/slog. Modern Go looks quite different from how it did just a few years ago.
Consider the magnitude of these changes: Go 1.18 (March 2022) introduced generics (type parameters), the biggest syntax change since Go's inception, allowing developers to write type-parameterized functions and data structures and ending the long-standing reliance on interface{} and code generation for generic logic. Go 1.21 (August 2023) added min, max, and clear as built-in functions while introducing the slices and maps standard library packages, providing generic utility functions for sorting, searching, cloning, and more — drastically reducing the need for hand-written loops. Go 1.22 (February 2024) fixed the for loop variable capture issue that had plagued the Go community for nearly a decade — previously, referencing a loop variable in a closure required the seemingly redundant i := i assignment to avoid bugs, but the new version automatically creates a new variable for each iteration. The for range n syntax also allows iterating directly over an integer, replacing the traditional for i := 0; i < n; i++ pattern.
Yet many AI assistants still tend to generate old-style boilerplate — manually copying loop variables, using third-party logging libraries, or writing verbose code for things that could be done in a single line. This means AI-generated Go code may be syntactically correct yet stylistically two or three versions behind.
JetBrains' open-source project go-modern-guidelines targets exactly this pain point. The project quickly gained over 2,200 stars on GitHub, with 300 new stars in a single day and 69 forks, showing strong community resonance with this issue.

Project Positioning: A Go Spec Written for AI
Unlike traditional coding style guides, go-modern-guidelines isn't aimed at human developers — its target audience is AI coding agents. The core idea is to provide a structured, machine-friendly set of modern Go writing guidelines to AI tools as part of their context or system prompt, thereby steering AI toward generating code that meets contemporary standards.
The logic behind this approach is straightforward. AI assistants are strongly influenced by the context provided to them during code generation. If you place an explicit "how modern Go should be written" guide in your project, the AI can work within those constraints and avoid falling back to outdated patterns from its training data.
Typical "Modernization" Improvements
While the specific items require checking the repository, such guidelines typically cover the following areas:
-
Leveraging new standard library features: Prefer
log/slogfor structured logging over third-party libraries likelogrus; use generic utility functions from theslicesandmapspackages.log/slogis a standard library package introduced in Go 1.21, providing structured, leveled logging capabilities. The traditionallogpackage only supports simple text output, with no convenient way to attach key-value metadata or support log levels (Debug, Info, Warn, Error). Beforelog/slog, the Go community heavily relied on third-party logging libraries likelogrus,zap, andzerolog, leading to inconsistent logging interfaces across different projects and libraries.slog's design draws from the strengths of these third-party libraries, offering aHandlerinterface for pluggable output formats (JSON, text, etc.) while maintaining the Go standard library's characteristically clean API style. Its introduction means most new projects no longer need external logging dependencies. -
New Go language features: In Go 1.22+,
for range nallows direct iteration over integers, and the loop variable scoping issue has been fixed — no more manuali := ivariable copying. -
Modern error handling: Use
errors.Join,errors.Is/errors.Asinstead of string comparison.errors.Join, introduced in Go 1.20, allows combining multiple errors into a single error value — extremely useful in scenarios requiring simultaneous reporting of multiple errors (such as concurrent operations or batch validation).errors.Isanderrors.As, introduced in Go 1.13, established the standard mechanism for checking error wrapping chains:errors.Isdetermines whether the chain contains a specific sentinel error, whileerrors.Asextracts a specific error type from the chain. Previously, many codebases used string comparison (e.g.,err.Error() == "not found") to identify error types — an extremely fragile approach that silently breaks whenever error message text changes. Modern Go error handling also recommends usingfmt.Errorfwith the%wverb to wrap errors, enablingIs/Asto properly traverse the error chain. -
Sensible use of generics: Use type parameters where appropriate to reduce code duplication, while avoiding over-generification.

Why go-modern-guidelines Deserves Attention
The "Context Engineering" Trend in AI Programming
go-modern-guidelines reflects a broader industry trend: context engineering is becoming the key to AI-assisted development. Rather than complaining about AI's subpar code, the better approach is to proactively shape AI output through carefully designed rule files, project conventions, and prompts.
Context engineering is a core concept that emerged in the AI-assisted development space during 2024–2025. Its central idea is that instead of relying solely on prompts to guide AI behavior, you should systematically design all the contextual information AI can access during code generation — including project structure, coding standards files, API documentation, test cases, conversation history, and more. This is more comprehensive than simple "prompt engineering" because it focuses not on optimizing the wording of a single interaction, but on how information flows to the AI across the entire development environment.
Similar practices have already appeared in various .cursorrules, CLAUDE.md, and AGENTS.md files. Specifically, Cursor automatically reads a .cursorrules file in the project root as system-level context for the AI; Claude Code reads CLAUDE.md; and GitHub Copilot supports injecting project-specific instructions via .github/copilot-instructions.md. These files fundamentally influence the style and quality of AI-generated code. JetBrains' project systematizes and specializes this practice for the Go language, providing a high-quality spec that these tools can directly consume.
A Signal from IDE Giant JetBrains
This project comes from JetBrains — the maker of GoLand and one of the companies that best understands developers' daily pain points. As one of the world's largest commercial IDE vendors, JetBrains' product line covers nearly every mainstream programming language (IntelliJ IDEA, PyCharm, GoLand, WebStorm, etc.), with millions of paying users.
Since 2023, JetBrains has been accelerating its AI strategy: AI Assistant is integrated as a built-in plugin across all IDEs, providing code completion, explanation, and refactoring features; Junie is JetBrains' AI coding agent, capable of autonomously planning and executing multi-step programming tasks including writing code, running tests, and fixing bugs. JetBrains has a unique advantage in AI — it deeply understands code semantics (through IDE-level AST parsing, type inference, and data flow analysis), enabling its AI products to deliver more precise code generation than general-purpose LLMs.
Having an official entity maintain a modern Go guide signals, in a sense, that IDE vendors are taking on the responsibility of "teaching AI to write good code" — something more authoritative and sustainable than scattered community rules. The go-modern-guidelines project is a concrete manifestation of JetBrains expanding its role from "providing tools" to "defining development standards for the AI era."
Practical Value for Go Development Teams
For engineering teams using Go, this guide can be applied immediately:
- Unify AI-generated code style: Incorporate it into your project's AI assistant configuration files (such as
.cursorrulesorCLAUDE.md) to ensure consistent code style across AI-generated output from all team members. This is especially important in large teams — when a dozen developers are simultaneously using AI assistants, without unified constraints, the generated code styles can vary wildly, increasing code review and maintenance costs. - Code review reference baseline: Identify "old-school" patterns in AI-generated code and improve review efficiency. Reviewers can quickly determine whether code uses outdated patterns (such as manual
i := i, third-party logging libraries instead ofslog, or hand-written sorting instead ofslices.Sort) and guide developers or AI toward more modern alternatives. - Onboarding material: Help new team members quickly learn modern Go best practices — even without AI, it serves as an excellent learning resource.
A Broader Takeaway: AI Adaptation Across Language Ecosystems
The significance of go-modern-guidelines may extend beyond Go itself. It raises a question worth considering for every language community: In an era where AI participates in coding at massive scale, do we need to maintain a dedicated modern-practices guide specifically designed for AI consumption for each language?
The answer is very likely yes. Languages evolve, best practices update, but AI model knowledge gets "frozen" in time. This lag needs to be bridged through external knowledge injection. This is fundamentally an information asymmetry problem: a language's latest idiomatic usage exists scattered across RFC documents, release notes, core team blog posts, and community discussions. AI models struggle to systematically learn "how you should write" from these fragmented sources, and instead tend to replicate the most frequently occurring patterns in training data — which are often from older versions.
We can expect similar "AI-specific modernization guides" to emerge in the Python, Rust, TypeScript, and other language communities, becoming standard components in AI-assisted development workflows. The Python community may need guides to steer AI toward match-case syntax (3.10+), tomllib (3.11+), and the latest type hint syntax; the Rust community may need coverage of the latest async programming best practices; and the TypeScript community may need guides ensuring AI uses the latest type system features like the satisfies operator and const type parameters. These guides will form a new infrastructure layer within the AI-assisted development ecosystem.
Conclusion
JetBrains' go-modern-guidelines addresses a real pain point of the AI programming era with a small but precisely targeted approach. It's both a practical tool and a signal — coding standards in the AI era are no longer written just for humans; they must also account for machine readers. For any Go development team incorporating AI assistants into their projects, this is an open-source resource well worth trying.
Related articles

Anthropic Sued: Claude Max 20x Plan Allegedly Delivers Only 6x Usage?
A lawsuit against Anthropic alleges Claude Max's 20x plan delivers only ~6x usage, and the 5x plan just 3.5x. We break down the legal details, community reactions, and the AI subscription transparency crisis.

Cursor Beginner's Guide: A Six-Step Workflow for Managing Changes, Rollbacks, and Validation
New to Cursor and keep breaking things? Learn a six-step dev workflow covering Cursor Rules, Plan mode, Diff review, and Checkpoint rollback to go from guesswork to engineering.

Is Cheap Cursor Reselling Reliable? The Real Risks of Shared Account Pools Exposed
An in-depth analysis of Cursor Pro budget reselling services, exposing the shared account pool model behind so-called legitimate accounts and deep discounts from technical, compliance, and data security perspectives.