Early Access Program Features

GoLand 2020.1 with Rich Code Completion Support for go.mod, Support for Macros in Run/Debug Configurations, and More

You can get this EAP build through the Toolbox App, by downloading it from the website, by using a snap package (for Ubuntu), or from right inside GoLand by selecting Automatically check updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.

Don’t forget that we regularly release nightly builds based on the latest development code. You can use them to get access to the latest features without having to wait for the official EAP announcements. The nightly builds are only available via the Toolbox App, however.

Download GoLand 2020.1 EAP #5

Go Modules

GoLand 2020.1 will provide code completion in go.mod files for:

  • go, module, require, replace, and exclude keywords.
  • Dependencies’ names.
  • Replacements with local paths, with the ability to rename them.

Also, when you move directories in the Project View, GoLand will change the path in go.mod file accordingly. On top of that, you can invoke Find Usages via the Project View to explore where a particular directory is used.

go-modules-code-completion

Code Completion

Сode Completion (⌃Space on macOS and Ctrl+Space on Windows/Linux) now suggests literals and conversions.

code-completion-for-literals-conversions

Smart Code Completion (⌃⇧Space on macOS and Ctrl+Shift+Space on Windows/Linux) in type assertion suggests the type of the assigned variable.

smart-completion-in-type-assertion

Quick-fixes

GoLand 2020.1 will provide a quick-fix via Alt+Enter to change a non-formatting call to formatting in a second.

convert-Println-to-Printf-call

Code Inspections

In Go, you can call methods with a pointer receiver even on expressions with a non-pointer type. The Go compiler will implicitly take the address of the expression to make the call valid, if possible. Otherwise, you will get a compilation error.

GoLand also detects such cases now, additionally suggesting a fix:

cannot-call-pointer-code-inspection

Use macros as parameters to run or debug

Now it’s possible to set macros as parameters in Go Tool and Program arguments fields of the Run/Debug Configuration dialog.

In the Macros dialog, you can choose macros such as:

  • $GOROOT$ to retrieve the path to the project SDK.
  • $GOPATH$ to retrieve the Go executable path.
  • $ClipboardContent$ to get the content of the clipboard.
  • $Prompt$ for a string input to be used as parameters in your configuration.
  • And other macros.

To open the Macros dialog in Run/Debug Configurations, click the + in the Go Tool arguments or Program arguments fields. You will see a list of available macros to use with a Macro preview.

Also, now you can store the configuration file in the project. Select the Store as project file option at the top of the Run/Debug Configurations dialog. In previous versions, it was possible to share this file in the .idea folder to share it through VCS with other team members.

macros-as-parameters-to-run-debug

External Documentation

Now when you use the External Documentation action, it navigates you to https://pkg.go.dev instead of https://godoc.org.

That’s all for this EAP week. Remember, we always appreciate your feedback! If you’re missing some functionality, or if you’ve encountered bugs or had an unpleasant experience, please share it with us here in the comments, on Twitter, or in our issue tracker.

image description