What′s New in GoLand 2018.1
In the update, we’ve added the Move refactoring. This refactoring allows you quickly move any top-level member to another file of the same package. A cross-package move is not yet allowed.
A bool expression suggested by code completion can now be selected and negated at the same time by pressing !.
Default value completion
If the caret stays on the right-hand side of a return statement inside a function, the code completion will now suggest a default value corresponding to the return type of the function.
New Postfix completion
- The .if template transforms a bool expression into an if statement
- The .p template prepends an expression with a pointer operator
More intention actions
There’s a number of new intentions added to the update, e.g. Flip for binary expressions, Negate, Negate recursively, and Invert for boolean expressions.
Some of the inspections that correspond to go vet and which are supposed to run before a go test in Go 1.10 were improved. The IDE will give a warning with type mismatches for the calls of fmt.Printf and with invalid build tags.
Auto-format on Enter
If you now click Enter when the caret is on a chain call or a string literal, the IDE auto-formats the resulting code.
Optimize imports on the fly
The editor is now able to remove import statements for unused packages on-the-fly as you type. This is convenient as you don’t have to remove those import statements by yourself anymore. This option is called Optimize imports on the fly. You can enable it in Settings | Go | Imports.
Reworked quick documentation popup
The Quick Documentation pop-up is now aware of example functions and includes them as part of the documentation. If you click the example function’s name, the IDE will open a Scratch File with the function’s code.
Scratch File improvements
A Scratch File, created from a Go code selection, now automatically gets all the proper import statements. Also, Scratch Files are now created from predefined templates, which can be customized in Settings | Editor | File and Code Templates.
Better debugger capabilities
The update allows you to now attach the Debugger to locally running processes. To do that, the only thing you have to do is click Run in the main menu and choose Attach to Local Process and select a process to debug.
Also, when debugging, the IDE can distinguish the shadowed variables in the Watches and Variables tabs of the Debugger tool window.
Now, when you work with a dep project and open a file that has an unresolved import statement, the IDE offers a quick-fix that runs dep ensure.
To create a new dep project, open the Project Wizard and switch to the Dep tab on the left-hand side of the dialog.
Better test runner
The update supports the hierarchy of tests and correctly attributes the output and compilation errors to individual tests and packages.
Running multiple files
The updated Go Build run configuration now lets you select and run multiple files.
Other coding assistance improvements
Here’s a list of some other improvements that will make your life much easier:
- The coding assistance provided by the IDE has been updated to fully support all the Go 1.10 features.
- The name suggestion algorithm used by Extract Variable, is now aware of the context and avoids name collisions.
- The auto-import mechanism has been made smarter and now applies only if the resulting code compiles with no errors.
- The Rename refactoring and Find Usages for global symbols are now much faster.
- To improve the IDE performance, the update allows you to limit the indexing scope in your project, e.g. to avoid indexing an entire GOPATH. The new option is available in both File | Settings | Go | GOPATH | Index entire GOPATH and the Project Wizard.
With the update you can now associate individual changes within a file with different changelists, commit and push them separately; similar to git add -p.
To include a change to a commit, use the checkboxes in the gutter in the Diff pane of the Commit Changes dialog. To move an individual change across changelists, use the change marker on the left-hand side of the editor.
More rebase actions
When you’re doing a rebase, there are now new Abort Rebase, Continue Rebase, and Skip Commit actions available in the Git Branches pop-up.
The update supports the new TypeScript 2.7 features, and also has a new Surround with type guard quick-fix for unresolved properties.
Smarter Rename refactoring
The Rename refactoring for classes now offers to rename the files as well. The refactoring is now available as an intention action on classes.
Reformat with Prettier
The update integrates Prettier, an opinionated code formatter. After you have the prettier package installed, the new Reformat with Prettier action becomes available.
Extract a Vue component
The update allows you to select an arbitrary fragment of a Vue template, and ask the IDE to extract it as a separate Vue component via Refactor | Extract or via Alt+Enter.
The Docker Compose run configuration dialog has been improved with support now for multiple compose files, and the ability to choose which services to run.
The Docker tool window can show all the Docker Compose projects that are configured within the project files and not only those that are configured with run configurations.
The update introduces initial support for Kubernetes through a plugin. The support includes code completion, inspections, quick-fixes for resource files, icons in the gutter for easier navigation, pop-up documentation, and live templates.