[Go in Practice] Writing Modern Go with AI: Testing JetBrains go-modern-guidelines and Refactoring a 1,039-line main.go JetBrains has released go-modern-guidelines, a plugin that provides contemporary Go writing specifications for AI agents to prevent them from writing outdated code due to training data cutoffs and frequency bias. The tool offers a CLI with list and explain subcommands, tailoring suggestions based on the Go version specified in a project's go.mod. In a test refactoring of a 1,039-line main.go, the plugin helped replace a hand-rolled string search with a standard library call, demonstrating its practical utility. In the AI era, even I delegate most of my code optimization or writing tasks to AI. However, due to factors in model training data, too many writing styles are outdated. This results in code that cannot utilize features of the latest Go versions, which is quite a pity. Fortunately, JetBrains released go-modern-guidelines , a very useful plugin. It makes your AI Agent smarter and teaches it how to use the latest syntax to optimize your Golang code. The positioning of this project is very straightforward: Provide contemporary Go writing specifications for AI agents so they don't write outdated Go due to knowledge cutoffs. The problem has two layers. The first layer is easy to understand: training data has a cutoff. Anything added to the standard library after that cutoff won't be used because the model hasn't seen it. The project's own example is errors.AsType T Go 1.26 ; if the model hasn't seen it, it naturally won't write it. The second layer is more subtle, which the project calls frequency bias : even if the model "knows" the new way, the old way appears overwhelmingly more often in the training data. In ten years of Go code on the internet, interface{} appears far more than any , and sort.Slice far more than slices.SortFunc . Models perform probabilistic prediction; the one that wins by majority vote is usually the old one. I really saw this second point in this refactoring. The original project had this snippet: // The oauth2 library can return an error containing "invalid grant" // when the refresh token is expired, revoked, or otherwise invalid. if err = nil { errorStr := err.Error // Basic substring check to avoid importing "strings" for i := 0; i <= len errorStr -13; i++ { if errorStr i:i+13 == "invalid grant" { return true } } } A hand-rolled string search, with a comment specifically explaining "to avoid importing strings". strings is in the standard library; the cost of importing it is zero. What this code actually needed was just one line: strings.Contains err.Error , "invalid grant" . The tool itself is a CLI with only two subcommands: list --go-version