プログラミングとソフトウェア開発

How Modern Go Guidelines Help AI Programming Agents Write Up-to-Date Go Code

GoLand from JetBrains has launched an open-source project that provides programming agents with guidance tied to the Go version used in a project, reducing their reliance on outdated patterns or incompatible features. The project uses the list and explain tools to provide the appropriate context incrementally without modifying project files.

2026-08-24
5 分で読めます
12 閲覧数
فريق تحرير certi.news
How Modern Go Guidelines Help AI Programming Agents Write Up-to-Date Go Code

AI programming agents may produce compilable Go code, but that does not mean they use the latest language syntax or standard-library additions. Older Go patterns are more heavily represented in training data, while newer features may not appear in the data on which the model was trained. To address this gap, JetBrains’ GoLand team created an open-source project called Modern Go Guidelines, which provides agents with practical guidance tied to the Go version declared in the project.

What does the project provide?

The guidelines cover useful language features and standard-library additions in Go versions 1.0 through 1.27, along with patterns handled by the go modernize analyzer. The agent does not receive guidance for versions newer than the version used by the project. If the go.mod file contains the go 1.25 directive, the agent can use Go 1.25 guidance and guidance for earlier versions, but it will not receive suggestions relying on Go 1.26 or Go 1.27.

According to the example in the article, this means the agent can suggest sync.WaitGroup.Go, introduced in Go 1.25, but it will not suggest errors.AsType, which requires Go 1.26. This connection between the guidance and the project version aims to reduce the likelihood of generating code that requires a newer version than the available environment, while also reducing the amount of unnecessary context the agent reads.

Progressive disclosure instead of loading all the context

The plugin includes a command-line tool called go-modern-guidelines and an instruction skill called use-modern-go. The tool supports two main commands:

  • list: Displays short, relevant guidelines for a Go file or a specific version.
  • explain: Provides a more detailed explanation and an example comparing the old pattern with the modern alternative.

The instructions recommend that the agent run the list command for the relevant file before modifying it, then use explain when it needs to understand a specific rule. Guidance can be requested for a file such as ./internal/worker/worker.go, or the version can be specified directly using --go-version 1.27. The output of list begins with the latest applicable guidelines and includes a stable identifier for each rule, such as sync_waitgroup_go, testing_t_context, and json_omitzero.

Examples of modern patterns

The guidelines include practical examples of replacing common patterns with newer ones, such as using slices.Contains instead of a manually written search loop, min and max instead of manual comparisons, and cmp.Or instead of a chain that selects the first non-zero value.

They also explain using sync.WaitGroup.Go instead of distributing Add, go, and Done operations separately; using errors.AsType for type-safe error matching in Go 1.26 and later; and using new(value) when a pointer to a value is needed in Go 1.26 and later. In Go 1.27, the guidelines present strings.CutLast and bytes.CutLast as alternatives to LastIndex and manual slicing.

The example for generic_methods, available since Go 1.27, shows how a generic operation can be moved from a package-level helper function to a method on the type when the operation is naturally associated with that type. The explain command returns an explanation of the rule with a before-and-after example, and it can also explain several rules in a single invocation.

What changes in practice for developers?

The core value here is not automatically updating old code, but giving the agent a small, focused reference while generating or modifying code. The project integrates with tools such as go fix rather than replacing them: Modern Go Guidelines helps the agent start with a modern pattern, while go fix helps update patterns already present in the codebase.

The plugin can be installed from the plugin marketplace or from a local repository. Integration requires the Go toolchain to be available in PATH. On first use, the integration installs the command-line tool through go install and stores it in a local cache without modifying the project itself. The article presents commands for adding the repository as a Claude marketplace, installing modern-go-guidelines, and enabling /use-modern-go. It also describes a path for testing a local repository before publishing or updating it, with examples that include Claude and Codex.

certi.news’ perspective

The project addresses a practical problem in using AI agents: code that builds correctly is not necessarily appropriate for the language version or based on the best available patterns. Linking the guidance to the go.mod file places a clear technical limit on what the agent can suggest, while progressive disclosure reduces the risk of overwhelming it with context it does not need. However, the tool does not eliminate the need for developer review or testing; it provides rules and examples for the agent, and the source does not establish that it independently verifies every change it produces. The stated coverage also reaches Go 1.27, so guidance for newer versions will still need to be added and updated.

ニュースの出典
JetBrains Blog
原文を開く ↗
ف
著者

فريق تحرير certi.news

同じカテゴリー

おすすめ記事

すべてのニュースを見る