Nilness analyzer inspection

In today’s post, I want to look at a new code analysis tool that has been present from the 2019.1 release of GoLand. It’s named Nilness Analyzer, and you can find it under Settings/Preferences | Editor | Inspections | Go | Probable bugs | Nilness analyzer.

This inspection helps us detect cases when we want to access information that could cause a panic, such as calling methods on a nil interface, using methods or members of nil structures, accessing nil slices, and so on.

Continue reading

Posted in New Features | Tagged , , | Leave a comment

GoLand 2019.1 Release Candidate is out!

GoLand 2019.1 Release Candidate is out, it means that we’re now in sight of the finish line, so if no critical issues are found, the release will go public.

Download GoLand 2019.1 RC

Get this RC build via our Toolbox App, from the website, as a snap package (for Linux), or directly from GoLand – just select Automatically check updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.

Please note that to use GoLand 2019.1 RC, you need to have an active subscription or start a 30-day evaluation period. In addition, we’ve stopped providing nightly builds until the next Early Access Program opens (for 2019.2).

This RC build brings useful tiny changes and bug-fixes, mostly for the debugger:

GO-7021 — The UI doesn’t freeze on auto-import anymore.

GO-6662, GO-6345 — The Variables tab in the debugger now displays the types contained in an interface and shows the address for the pointers inside a type.

debugger addresses - optimized

GO-6989 — Unreadable variables are hidden in the debugger now.

GO-7062
— Navigation to struct fields in the debugger is working correctly.

GO-6509
— Setting the value for struct fields, pointers, and interface values in the debugger works as expected.

We love to hear from you! Do share your feedback with us: here in the comments, on Twitter, or our bug tracker.

Posted in New Features, News | Tagged , , , | Leave a comment

GoLand 2019.1 Goes Beta

The upcoming GoLand 2019.1 is now in Beta!

For three months now, our team has worked hard to turn our roadmap into reality, to meet your expectations, and hopefully to feel that pleasant fatigue that you get after you’ve done even more than planned.

After this Beta milestone, we will mostly focus on eliminating bugs and polishing UI elements and everything around until the major release.

Get this Beta build via our Toolbox App, from the website, as a snap package (for Linux), or directly from GoLand – just select Automatically check updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.

Download GoLand 2019.1 BETA

Before I give you the headliners of this release, let me just note that the Beta is quite stable in comparison to our other EAP builds, though some clumsy things may still pop up here and there.

blog@2x

Continue reading

Posted in EAP, New Features | Tagged | 2 Comments

Debugging in GoLand – Windows minidumps

A while back we talked about debugging the core dumps produced on Linux systems.
Since then, the IDE has had an update that allows it to debug the equivalent memory dumps produced on Windows systems, called minidumps. As with core dumps, minidumps can be analyzed on any operating system, not just on Windows. Please note that you will need GoLand 2019.1 or higher to use this feature.

Continue reading

Posted in EAP, New Features, Roadmap | Tagged , , , , , | Leave a comment

GoLand 2019.1 EAP 8: Built-in Heap, Mutex and Block Profilers

GoLand 2019.1 EAP 8 is here!

Get this new EAP build via our Toolbox App, from the website, as a snap package (for Linux), or directly from GoLand – just select Automatically check updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.

Download GoLand 2019.1 EAP 8

Built-in Heap, Mutex, and Block Profilers

Profiling is the best way – and sometimes the only way – to know the real performance of your application.

That’s why we are happy to let you know that GoLand has expanded its tooling support by integrating with Memory, Mutex, and Blocking profilers in addition to the CPU profiler.

You can run profilers right from the IDE, and then review the analysis results in a dedicated tool window (View | Tool Windows | Performance Profiler).

To run the profiler, use the new Run with Profiler button and choose the required configuration in the navigation toolbar. Alternatively, select any of new actions in the run menu, which appears when you click on the run icon in the left gutter.

run-with-profiler-options

To get a better understanding of the possible performance issues in your code, sort the results by metrics. Each particular profiler has different metrics appropriate for its type via the Metric’s popup menu.

The Memory Profiler lets you sort and explore the results by Allocated objects, Allocated space, In-use objects, and In-use space. The Blocking Profiler and Mutex Profiler provide two options for metrics: Contentions and Delay.

Continue reading

Posted in EAP, New Features | Tagged , , | 4 Comments

Refactorings in GoLand – Extract Interface

In today’s article, we will talk about the Extract Interface refactoring, a new refactoring available since GoLand 2019.1.

This refactoring allows us to take a type and extract all the method definitions that we need, then create a new interface from them. This operation is particularly useful when going from a single implementation to using multiple implementations, such as in the example below.

To invoke this, you can use the Refactor This shortcut, Ctrl+Alt+Shift+T on Windows/Linux or ^T on macOS.

Refactoring - Extract Interface - 1

The Extract Interface dialog allows us to select any method from the existing type and control where will the interface be extracted. As such, you can create the interface in the current file/package, by default, or in a new file/package or existing ones but different than the current ones. You can also control if the methods should be exported or not, in case you do not want for external packages to be able to implement the interface.

Refactoring - Extract Interface - 2

That’s it for today. We learned how to use a new and powerful refactoring feature that will help us as the code base grows. Please let us know your feedback in the comments section below, on Twitter, or on our issue tracker.

Posted in EAP, New Features | Tagged , , | Leave a comment

Debugging with GoLand – Advanced Debugging features

Today we start the last article in the series of debugging with GoLand. Previously we addressed points such as configuring the debugger and the debugging session, how to control the debugger execution flow and configure breakpoints, and what are some of the latest improvements in the upcoming 2019.1 version.

In today’s article, we will talk about two advanced debugging features of GoLand: Core Dump debugging and using Mozilla rr, a reversible debugger.

Debugging core dumps

Core dumps are memory snapshots of running applications taken at a certain point in time. They can help us visualize all the goroutines present, with all the values for the variables, as well as the current execution point for each active goroutine.

Right now, GoLand supports only Core Dumps taken on Linux systems, but it can read and analyze them on any operating system.

There are two ways to obtain a core dump. If we want to see the in-memory values as the process terminates because of a crash, we need to set the ulimit to be reasonably high, e.g., sudo ulimit -c unlimited, and have the following environment variable configured GOTRACEBACK=crash.  This will enable Go applications to crash with a stacktrace printed and with a core dump file written.

To be able to get core dumps from a running process without having to crash it, we need to have gdb installed on the system and run these commands:

Note that this value will be reset on system restart and you’ll need to configure it again.

To generate and use the core dump, we need to configure the IDE to save the binary in a known location, such as our project root directory.

Debugging with GoLand - 18
Continue reading

Posted in Features, Tutorial | Tagged , , | Leave a comment

GoLand 2019.1 EAP 7: Install any Go SDK right from the IDE

GoLand 2019.1 EAP 7 is out!

Get this new EAP build via our Toolbox App, from the website, as a snap package (for Linux), or directly from GoLand – just select Automatically check updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.

Download GoLand 2019.1 EAP 7

Maybe you have already realized that GoLand is more than just a Go IDE. It is continually expanding its capabilities for working with web development, databases, and SQL. Thanks to the WebStorm and DataGrip teams, if you want to play with the React library or Cassandra database, there are no obstacles in your way.

Download and install the Go SDK right from the IDE

When creating a new project in GoLand, there is now the option to download and install any required version of the SDK, including Beta and RC versions. You don’t have to leave the IDE or go surfing through the Web anymore.

As soon as the selected SDK version is installed, GoLand will notify you in the Event Log window.

download-sdk

A new inspection based on nilness analysis

To show that some function failed to calculate its result, we return an additional error value. If the error is nil, we can safely use the calculation result. Proper error handling in such cases can be tricky, so we’ve added a new inspection that warns you if an error corresponding to some variable is not checked.

Here are a couple of examples:

nilness-analyzer-inspection-1

nilness-analyzer-inspection-2

Continue reading

Posted in EAP, New Features, Uncategorized | Tagged , , | 2 Comments

GoLand 2019.1 EAP 6 is out with built-in CPU profiler, Export intention action, and support for new databases

GoLand 2019.1 EAP 6 is here!

Get this new EAP build via our Toolbox App, from the website, as a snap package (for Linux), or right in GoLand – just select Automatically check updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.

Download GoLand 2019.1 EAP 6

CPU Profiling

Let’s start with a brand new feature that we are excited to release to all our users: the addition of profiler support for Go applications. This allows you to run the CPU profiler on your Go applications and then use the results without ever leaving the IDE.

One way to use this feature is to write benchmarks for your code and then the IDE will let you profile them as you would any other Test or Application.

Built-in CPU profiler in action

Continue reading

Posted in EAP, New Features | Tagged , , , | 3 Comments

Debugging in GoLand – Improvements in 2019.1

We kicked off this series with how the debugger can be launched and then went on to explain how you can interact with it and configure various breakpoint properties.
Today we are continuing on this series with a look at some of the new features available in the debugger which can bring some significant improvements to your quality of life, at least a less stressful time debugging.

Before we go on, please note that these features are available only from the 2019.1 release of the IDE.

We touched briefly on the support for controlling the execution flow in the debugger by using functionality such as Step Over an instruction, Step Into a function call, Step Out of a function call. But what happens when we want to step into a function call but there are multiple instructions on the same line?

Continue reading

Posted in Features, Tutorial | Tagged , , , | Leave a comment