Friday, August 14, 2026
HomeGolangWrite Trendy Go Code With Junie and Claude Code

Write Trendy Go Code With Junie and Claude Code


GoLand
Information

Go builders can now confidently write trendy Go code utilizing the AI brokers Junie and Claude Code. We at JetBrains have simply launched a new plugin with pointers for AI brokers that guarantee they use the most recent options and comply with greatest Go practices suitable together with your present model of Go, as laid out in go.mod. Yow will discover the related GitHub repository at go-modern-guidelines.

Why do you want it?

With two main releases yearly, Go is without doubt one of the extra ceaselessly up to date languages. But we’ve discovered that each one AI brokers – Junie and Claude Code included – are likely to generate out of date Go code.

The Go workforce additionally pointed to that drawback in one in all their articles: “In the course of the frenzied adoption of LLM coding assistants, we turned conscious that such instruments tended – unsurprisingly – to provide Go code in a method much like the mass of Go code used throughout coaching, even when there have been newer, higher methods to precise the identical thought.”

For instance, right here’s a pattern code snippet of how an agent used a handbook loop to search out a component within the slice:

// HasAccess checks if the consumer's position has entry to protected assets.
func HasAccess(position string) bool {
    for _, allowed := vary allowedRoles {
       if position == allowed {
          return true
       }
    }
    return false
}

There are two principal the reason why brokers would favor out of date structure the place cleaner and extra idiomatic options can be found:

  • Knowledge cutoff: Even probably the most present AI fashions are skilled on time-bound datasets which have a “cutoff” date (for instance, for Claude Opus 4.6, that’s Might 2025). They won’t acknowledge or recommend options that had been launched after that time, similar to these discovered within the Go 1.26 launch.
  • Frequency bias: AI fashions are primarily skilled on open-source codebases that will not be readily up to date. It’s pure that such datasets will characteristic extra “outdated” code than “new”, and since AI fashions favor alternate options which are extra frequent, they may recommend out of date code in consequence.

Identical to the Go workforce, we at GoLand, try to maintain the Go ecosystem trendy and idiomatic. So to mitigate the impact of AI brokers contributing to this situation, we’ve created a plugin with a set of pointers for Junie and Claude Code, that helps them generate trendy Go code. The plugin robotically acknowledges the present model of your Go code (laid out in go.mod) and instructs the agent to make use of corresponding options, similar to new(val) as a substitute of x := val; &x or errors.AsType[T](err) as a substitute of errors.As(err, &goal) (each launched in Go 1.26), in addition to stdlib additions obtainable as much as and together with that model.

Right here’s the identical code pattern from earlier than with our pointers utilized, the place the agent really makes use of the fashionable slices.Incorporates() technique launched in Go 1.21.

var allowedRoles = []string{"admin", "moderator", "editor"}

// HasAccess checks if the consumer's position has entry to protected assets.
func HasAccess(position string) bool {
	return slices.Incorporates(allowedRoles, position)
}

Find out how to allow

In Junie

For Junie model 2xx.620.xx or greater, you don’t must do something – these pointers will probably be utilized proper out of the field.

If you happen to’re operating an older model, go to SettingsPluginsPut in, discover Junie, after which click on Replace.

If, for some cause, you need to disable these settings, you are able to do so in SettingsInstrumentsJunieMission SettingsGo. The Present trendy Go pointers possibility is enabled by default, so untick the field.

In Claude Code

To make use of these pointers in Claude Code, run the next instructions inside a Claude Code session to put in it.

Add this repository as a market:

/plugin market add JetBrains/go-modern-guidelines

Set up the plugin:

/plugin set up modern-go-guidelines

To activate it, run the next command at the beginning of a session:

/use-modern-go

Claude Code will then detect the Go model from go.mod and instruct the agent to make use of trendy options suitable with that model.

> /use-modern-go

This mission is utilizing Go 1.24, so I am going to stick with trendy Go greatest practices

and freely use language options as much as and together with this model.

If you happen to'd desire a distinct goal model, simply let me know.

After this, any Go code that the agent writes will comply with the rules.

Completely happy coding!
The GoLand workforce

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments