News from Go, or what's new in GoLand 2018.1

    Hello, Habr! GoLand 2018.1

    was released late last week ! This release is special for our team - this is the first major update to the IDE since its launch four months ago. Editing tips and code navigation, which our team is proud of, have become even more intelligent and convenient. Integration with many tools brought to mind. The update supports partial Git commits, integration with Dep , the ability to debug local Go processes, improved support for Docker Compose , added tips for editing Kubernetes files , and much more. Below is more about what hit the release.


    In this update we added Move refactoring . Using it, you can quickly move any top-level character to another file within the same package:

    The name suggestion algorithm used by Extract Variable now takes into account context and avoids name collisions. Rename

    refactoring for global characters is now much faster (like Find Usages ). Auto-completion The boolean expression prompted by the compliment can now be selected with simultaneous negation by pressing "!": If the cursor is located to the right of the return statement inside the function, auto-completion offers default values ​​according to the type of value returned by the function:

    The new version adds two Postfix Completion templates .

    • The new “.if” template converts a Boolean expression into an if statement:

    • The new “.p” template substitutes the pointer operator at the beginning of the expression.

    Intention actions

    The update has introduced several new Intention actions , for example Flip for binary expressions , Negate recursively and Negate for Boolean expressions:

    In addition to Negate , Invert can now also be used for if expressions : Other auxiliary tools Here are some other improvements that will help you in your work:

    • The automatic import mechanism has become smarter and now works only if the resulting code is compiled without errors.
    • If the cursor is on a call from a chain or on a string literal, by pressing Enter IDE automatically formats the received code.
    • The editor can now remove import statements for unused packages right while working in the editor. This parameter is called Optimize imports on the fly . It can be enabled in the Settings | Go | An Imports .
    • The Quick Documentation popup now takes into account sample functions and includes them in the documentation. If you click on the name of the example function, the IDE will open the Scratch File with the code for this function:

    Scratch Files

    These same Scratch Files that you may have already experimented with provide a Go Playground -style editing session with full IDE support. In the new version, they also got better. Firstly, in the Scratch File created from the selected Go code, all necessary import expressions are now automatically added. Secondly, such files are now created from templates that can be configured in the Settings | Editor | File and Code Templates .


    In the new version, the debugger can be attached to locally executed processes. To do this, just click Run in the main menu and selectAttach to Local Process : The

    IDE will prompt you to select the process for debugging:

    After selecting the process, the Debugger tool window opens and breakpoints begin to work.


    Another important piece of news - in the latest update dep support for the dependency management tool appeared.

    When an existing dep project is imported, the IDE detects the dep and asks to enable integration with it.

    If you open a file with an unresolved import statement when working with the dep project , the IDE offers quick-fix that runs dep ensure :

    Support Go 1.10

    All IDE tools for working with code have been updated and fully support all the features of Go 1.10 .

    Code style

    Among the parameters Code Style some new: the Use back quotes for imports folder , the Add parentheses for a single import statement and the Add a leading space to comments The .


    Another major innovation in the latest update - finally, support for partial Git commits has appeared.

    Now you can choose which changes in the file you want to include in the commit:

    These individual changes within the file can be distributed across different Changesets. To do this, click on the change marker located on the left panel of the editor:

    In the pop-up window of Git Branches , new actions for rebasing have appeared: Abort Rebase , Continue Rebase and Skip Commit .

    Finally, the VCS tool window now allows you to group changes into repositories.

    User Interface

    Preview in the Replace in Path popup window now works even if a regular expression is used.

    Any folder from the Project tool window is now easy to open in the terminal window. To do this, use the Open in Terminal action.

    In addition, the IDE now correctly processes fractional scale factors when using multiple HiDPI monitors .


    In the new version, you can improve the performance of the IDE by limiting the indexing area for the project, for example, so as not to index the entire GOPATH .

    JavaScript / TypeScript

    Support for front-end technologies such as TypeScript and JavaScript has improved significantly thanks to the achievements of the WebStorm team.

    Here are the most important changes:

    • TypeScript 2.7 support
    • New quick-fix Surround with type guard for "unresolved" properties.
    • Rename refactoring for classes also suggests renaming the file. This refactoring can now be called through the Intention action on the class.
    • If the Prettier package is installed , the Reformat with Prettier action appears in the IDE .
    • New refactoring Extract a Vue component .
    • It has become more convenient to work with package managers. Now you can explicitly select npm or Yarn to install dependencies and run scripts.
    • If you have already switched to Webpack 4 , the IDE offers hints for parameter names in the webpack configuration file.
    • Npm scripts can now be run directly from the editor using the icons in the left panel, like tests.


    Finally, we cannot but mention the new plugin for Kubernetes :

    For more information about working with the plugin, see the IntelliJ IDEA blog post .

    Here is a long list. We hope you find one of these useful. And if not, tell us what you are missing or what I would like to add.

    Learn more about these and other changes on the What's New page .

    You can download the update on the download page or through the Toolbox App .

    As always, we welcome your feedback and try to answer any questions.

    Have a nice development!

    Also popular now: