GoLand 2025.3 Help

Analyzing code for syntax updates

Syntax updates help you migrate Go code to newer language versions. When a new Go version becomes available, GoLand analyzes your code and suggests updates that use modern language and standard library features.

Syntax updates are implemented as inspections. Each inspection reports a specific outdated construct and provides a quick-fix that rewrites the code to the newer form. These fixes are designed to be safe and behavior-preserving, so you can apply them individually or in bulk.

You can use syntax updates to modernize existing codebases and keep them aligned with the latest Go language evolution.

Applying syntax updates

When a syntax update is available, GoLand highlights the affected code in the editor. You can apply a fix using the intention actions menu or run the inspection over a larger scope to update multiple files at once.

By default, these updates are highlighted with a blue underline and marked with the language updates icon (Syntax update icon).

Apply syntax updates by using a quick-fix

  1. Place the caret at the code element that you want to modify. Then click the light bulb icon (or press Alt+Enter) to open the list of suggestions.

    Intention preview opens automatically. If an intention is complex, and the preview cannot be generated, you will see the intention description. Hover over available intentions on the suggestion list to preview them.

  2. Press Enter or click an intention on the list to apply it.

    For more information about quick-fixes, refer to Intention actions.

    Syntax updates example

Syntax updates use a dedicated inspection severity level called Syntax updates. You can configure this level the same way as other inspections in the settings.

Change severity for syntax updates

  1. Press Ctrl+Alt+S to open settings and then select Editor | Inspections.

  2. Navigate to Go | Syntax updates.

  3. Select an inspection from the list.

  4. From the Severity list, select a new severity level.

  5. From the Highlighting in editor list, select the style that you want to use to highlight code fragments in the editor.

  6. Apply the changes and close the dialog.

    The modified inspection will now have the new severity level in the selected profile.

    For more information about inspections, refer to Code inspections.

    Change severity for syntax updates

After you apply a quick-fix, GoLand suggests analyzing your code to find other places where syntax updates can be applied.

Analyze code for additional syntax updates

  1. Click Analyze code for syntax updates.

  2. In the Specify Syntax Update Scope dialog, select the scope and click Analyze.

    Analyze code for other syntax updates

Alternatively, you can run code analysis for syntax updates from go.mod.

Running analysis from go.mod

  • In go.mod, click Analyze code for syntax updates. Click Show highlights of Go to see an overview of new languages.

    Running analysis from go.mod

You can apply a quick-fix to a single occurrence or apply all available fixes at once.

Apply syntax update quick-fixes

  • To apply a fix to a specific occurrence, open the Problems tool window, select the occurrence, and click Apply Fix.

    Apply a syntax update quick-fix
  • To apply fixes in bulk, open the Problems tool window, right-click a group under the Syntax updates node, and select the available quick-fix. You can also click the Apply Fixes button for the group.

Supported syntax updates in Go 1.26

Go 1.26 introduces several language and API improvements. GoLand provides dedicated inspections to help you adopt these changes automatically.

Pointer creation with new(expr)

Go 1.26 extends the new built-in function so it can accept expressions, not only type names. This allows you to create pointers directly from expressions, without introducing temporary variables.

This change also removes the need for helper functions that exist only to create pointers, such as proto.Int64(), proto.String(), or proto.Bool().

Before:

birthDate := time.Date(1986, 10, 1, 0, 0, 0, 0, time.UTC) activeVal := true ageVal := calculateAge(birthDate) return UserProfile{ ID: 101, Username: "Gopher", IsActive: &activeVal, Age: &ageVal, }

After:

birthDate := time.Date(1986, 10, 1, 0, 0, 0, 0, time.UTC) return UserProfile{ ID: 101, Username: "Gopher", IsActive: new(true), Age: new(calculateAge(birthDate)), }

GoLand provides the Pointer creation with new() inspection. It detects cases where a temporary variable is created only to take its address and suggests the Replace with new() quick-fix.

Type-safe error unwrapping with errors.AsType

Go 1.26 introduces errors.AsType, a generic and type-safe alternative to errors.As.

The errors.As function requires manual pointer handling and can panic if the target type is incorrect.

Problematic usage:

var cfgErr ConfigError // value, not pointer if errors.As(err, &cfgErr) { // panic fmt.Println("Config error on field:", cfgErr.Field) }

errors.AsType infers the target type automatically and returns a typed result. It does not rely on caller-prepared pointers and cannot panic due to a mismatched target type.

Using errors.AsType:

if cfgErr, ok := errors.AsType[*ConfigError](err); ok { fmt.Println("Config error on field:", cfgErr.Field) }

GoLand provides the Type-safe error unwrapping with errors.AsType inspection. It reports usages of errors.As that can be replaced and offers the Replace with errors.AsType quick-fix.

05 February 2026