Complete Current Statement

Add trailing commas or braces and move the cursor to the right place with a single keystroke.

GoLand can complete statements and add required trailing commas for any composite literals (like struct, slice, etc.), and even place caret in a position where you can just start typing the next statement.

After typing parentheses, trigger the Complete Current Statement action, ⌃⇧⏎ (macOS) / Ctrl+Shift+Enter (Windows/Linux), to add curly braces and move ethe cursor down to the beginning of the next row.


Related Resources

Better Time Format in Completion
Better Time Format in Completion
Use the commonly known date/time formatting strings while writing time formatting in Go.
Code Completion in Language Injections
Code Completion in Language Injections
See how to use code completion inside strings and other places.
Completion for non-imported Go Modules
Completion for non-imported Go Modules
Import a module in to your project.