GoLand 2020.1 EAP 4: Support for Environment Variables, and You Can Use GoLand as a Simple Text Editor
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 these nightly builds to get access to the latest features without having to wait for the official EAP announcements. These nightly builds are only available via the Toolbox App, however.
Go Modules
Go 1.13’s environment variables GOPROXY
, GOPRIVATE
, GOSUMDB
, GONOPROXY
, and GONOSUMB
are now supported.
On the Go Modules projects template, you can easily configure the defaults for the values of all the environment variables in one place, get a short description for each one, and navigate to the https://golang.org source to get more information about them. Simply click the Browse icon in the Environment field to open the new Environment Variables dialog.
Quick-fixes
The Create variable quick-fix now shows an expected type hint, making it easier for you to enter the right value. In addition to this, it automatically provides the Initialize with zero value completion item, which creates a full variable declaration with the expected type, instead of a short declaration.
Code Inspections
The code inspection Invalid conversions of uintptr to unsafe.Pointer warns you about incorrect uses of uintptr to unsafe.Pointer to convert integers to pointers.
The code inspection Unmarshal is called with incorrect argument analyzes calls to json.Unmarshal
and similar functions of encoding/json
, encoding/xml
and encoding/gob
packages.
It reports a problem if the argument that is passed to store the result is not a pointer or an interface. Such calls are guaranteed to fail and return an error.
Refactorings
In-place Rename
GoLand 2020.1 will provide a simpler way to perform the Rename refactoring.
You no longer need to deal with a modal dialog to change the name of any declaration. Simply edit the name of a method or function, and then use the new gutter icon or an intention action (Alt+Enter) to review. The IDE will show a gutter icon that will offer to rename all its usages.
Extract Method
Now when you extract a method or a function using the Extract Method refactoring, it keeps the original order of the parent function/method parameters.
Using GoLand as a simple text editor
With the new LightEdit Mode, you can open a file in the text editor window without creating or loading a project.
To try this new functionality out, you will first need to create a command-line launcher from Tools | Create Command-line Launcher as described here. If you’re using the Toolbox App, the steps will be slightly different.
For more detailed instructions on how to open a file, compare/merge files, and even run code inspections, see this web help section.
If GoLand has already been launched, the file will be opened in it. If GoLand is not yet running, the file will be opened in LightEdit Mode instead.
Other
GoLand 2020.1 will run `go list` to get dependencies less often. For Go 1.14, it uses a temporary copy of the go.mod file to avoid undesired changes in it.