Shell Scripting with GoLand 2019.2

Go developers may rely at times on shell scripts to perform various tasks. In this post, we’ll have a look at the new builtin support for Shell scripting in GoLand 2019.2.

First, we need a new shell script file, let’s call it hello.sh.

As you have probably noticed already, the IDE will also prompt you to install a helper application. This is called ShellCheck, and it’s going to help you check your shell scripts against common issues and look for possible optimizations.

After we click the Install link, we can go on and start working on our script. We could skip installing the tool for now, of course, but having static analysis on our scripts is always better.

As a small note, if you are using Windows like I am, make sure to change the line endings to LF.

new shell script

Starting the shell script with the traditional #! will also give us our first chance to interact with completion. Let’s use bash as our interpreter.

shell script file header completion

The IDE will be able to suggest not only keywords but also directory names and relative/full paths.

shell scripting code completion

And since we have installed ShellCheck already, let’s see it in action and use the inspections/quick-fix system that is similar to all the other programming languages that we support.

shell script quick-fix

You can also get help on the items that are being completed, by invoking the Quick Documentation feature. And that’s not all. If you want an explanation of a more complex command, you can use Alt+Enter on the line with the command, then choose the Explain shell feature, and select the expression to you wish to have explained. This will open a browser window using the ExplainShell website to describe the selected command.

explain shell

Do you want to run the scripts? Then you have probably noticed there’s a familiar green arrow at the top of the script and the same shortcuts you are used to will work as well. In my case, I need to run the script via WSL, which will hopefully be a bit more integrated in the future.

run shell script

Finally, to help make it easier to maintain the scripts, the IDE integrates with Shfmt, an open-source tool meant to standardize the formatting of shell scripts. To call it, invoke the built-in formatter tool and it will prompt you to install it automatically.

format shell script

So, why would you use an IDE for working on shell scripts? Because, as we’ve seen, shell scripting does not need to be complex or inconsistent. GoLand all our other JetBrains IDEs are here to help you – even in cross-platform environments.

Please let us know your thoughts on this in the comments section below, on our issue tracker, or on Twitter. And if there are any topics that you’d like to see covered in the future on this blog, we’ll be happy to do so.

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

GoLand 2019.3 Opens its Early Access Program!

The first Early Access Program (EAP) build for GoLand 2019.3 is ready for you to try. You can get it via the Toolbox App, download from the website, or use a snap package (for Ubuntu). Or, right in GoLand, select Automatically check updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.

blog@2x

A month ago we published our roadmap for 2019.3. In it, we briefly outlined our primary goal for this release – fighting bugs, glitches, unexpected behavior, usability, and performance issues. However, it looks like we will add a few new things too.

Download GoLand 2019.3 EAP 1

If you’re new to GoLand and wondering about this Early Access Program business, here’s what it’s all about.
Continue reading

Posted in EAP, New Features | Tagged | 2 Comments

GoLand 2019.2.2 is Out!

The GoLand 2019.2.2 bug-fix update is out!

Download GoLand 2019.2.2

Update to it via the Toolbox App, go to 2019.2.1 and click Help | Check for Updates, or download a copy from our website.

Performance and UI

We’ve fixed several performance and usability issues:

GO-8031 — GoLand now shows the ‘implemented’ icon for a method much faster as it processes fewer elements during analysis.

GO-8034 — The UI doesn’t freeze anymore when clicking on the gutter icon for a type that implements the interface and has a lot of methods.

GO-7952Fill Fields is more helpful when you use existing variables as field values.

Refactorings

GO-8065, GO-8068Extract Interface respects existing declarations and doesn’t complain about unexported receiver’s type if it’s not used in the newly created interface.

GO-7982Change Signature takes care of the package prefix in tests.
Continue reading

Posted in Releases | Tagged , | Leave a comment

Increase productivity with Custom Postfix Completion templates

A while ago, we wrote an article about 14 different ways the IDE can assist you with code completion.

Out of those, Postfix Completion stands apart as it lets you continue to type after the identifier name and get suggestions for it, similar to the example below:

.Sort Postfix Copletion Template in action

As you can see, using the .sort completion option is much faster than you typing out the whole code snippet for sorting the slice yourself.

Before version 2019.2, however, you were forced to use the Postfix Completion items defined by the IDE. But all of that has now changed, and you can now create your own templates.

Why might this be useful, you ask?
First and foremost, it’s because now you don’t have to wait for a release cycle (at the very minimum) of the IDE to get your favorite completion snippet.
And second, it can be set up for you and save you time and effort specifically with your code.

Take the example in the above picture. It’s not hard to type the whole sort.Slice line, especially given the completion power of the IDE, but it’s a lot quicker to type commits.sort, which also feels natural as you type it.

Let’s look at an example of this in action using a task that might not be that frequent but still requires some typing: removing an element from a slice.

Open up Settings/Preferences | Editor | General | Postfix Completion. Here you’ll be able to view the existing templates and define new ones.

postfix completion - see list

To write our own postfix completion option, let’s use + | Go and then give the completion option a name, or Key as it’s defined in the dialog. This allows us to identify the way the snippet will appear in the completion options.
Continue reading

Posted in New Features | Tagged , | Leave a comment

Refactorings and Quick-fixes changes in 2019.2

Refactorings and quick-fixes are one of the areas that set IDEs apart from text editors. With them, you can quickly move parts of code around in a safe manner, rename identifiers or change function/method signature across large codebases, extract interfaces from existing types, and even extract/inline values.

As such, it should come as no surprise that we gave them a bit of a tweak in 2019.2, and made them even better.

Refactorings in 2019.2

Let’s start with the improved Extract Method refactoring.

Previously, it was not possible to use it with code that contained a return statement. Thanks to feedback from our users, we made some changes to this refactoring and now it’s possible to use it in more conditions.

You might be asking yourself, ok, but what happens if my code selection contains such paths? How will the IDE transform the code? In this case, the IDE will automatically generate the exit code path for you by returning an additional boolean value and placing a check in place of the extracted code.

Let’s see it in action:

2019.2 - Extract Method with returns

Pretty amazing, right?

Now, let’s look at one of our more versatile refactorings: Change Signature. Introduced about a year ago, it gives us new quick-fixes to help fix broken, incomplete, or changing code.

This sets us up nicely for the second part of this article…

Quick-fixes in 2019.2

If you don’t want to read a lot of text, you can get a pretty good feel for what quick-fixes are now possible from the image below:

2019.2 - Change Signature Quick-fixes

But, if you are after something a little more substantial:

GoLand can now suggest and then change the signature of myHandler to match the expected type by the HandleFunc call, HandlerFunc:

It also can add missing parameters to functions with the correct type:

Are you adding errors to your functions or any other new return types? The Change Signature refactoring provided us with smarter ways to fix the following codebase:

All these changes mean that we can prototype the code quicker and you have support to safely enhance the existing codebases with new functionality.

That’s it for today. We’ve learned how the changes in the existing refactoring and quick-fixes systems allow us to become more productive and perform safer changes to codebases of any size.

Let us know your thoughts about these changes, or any others from 2019.2, in the comments section below, on our issue tracker, or on Twitter. Also, let us know what you’d like us to cover next. Is there anything you would like to learn more about in our IDE or what can we help you with to be an even more productive programmer?

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

2019.2 Features that Make Debugging Easier

GoLand 2019.2 brings with it a lot of new features and bug-fixes. In addition to making the debugger compatible with the new features in Go 1.13, we’ve added a few more things to help you debug code even more quickly and efficiently.

Function call support

Let’s start with one of the most highly anticipated and requested features: function call support.

With this new version, you can now call functions during a debugging session. This is made possible thanks to some experimental support in Delve, the underlying debugger used by the IDE, and experimental function call support in the Go runtime.

Continue reading

Posted in New Features | Tagged , | Leave a comment

GoLand 2019.2.1 is Out!

We have just released a new, fresher version of GoLand 2019.2 – the 2019.2.1 bug-fix update.

Try it via the Toolbox App, update from 2019.2 by clicking Help | Check for Updates, or just download a copy from our website.

Download GoLand 2019.2.1

This update addresses the following issues:

GO-6994, GO-7787 — GoLand now always optimizes imports after you apply the Move refactoring. The Refactoring Preview pane allows you to check if the generated file is going to be changed by optimizing or sorting, and to discard the change if anything goes wrong.

GO-7789 — A glitch affecting the Sync packages quick-fix has been fixed. Now it doesn’t highlight a dependency as an error after it’s downloaded in projects that use the Go Modules integration with the Vendoring mode enabled.

JBR-1624, JBR-1645 — Fixed the broken Fira Code fonts rendering.

GO-7593 — The Create field quick-fix doesn’t move lines with comments anymore.

GO-7741Code Completion inserts the correct type of brackets for structs.

GO-7752 — GoLand’s code formatter aligns type definitions in the right way.

GO-7808Code Completion is more precise.

GO-7852 — SQL injection works as expected.

GO-7824, GO-7871Change Signature doesn’t generate non-existing types, works well with replacing single result parameter, and adds default value in newly generated return.
Continue reading

Posted in Releases | Tagged , | Leave a comment

What’s next: GoLand 2019.3 roadmap

Three weeks ago we released GoLand 2019.2 with function calls support in the debugger, enhanced color schemes, customizable Postfix Completion templates, smarter Go Modules and dep integration, quick-fixes based on the Change Signature refactoring, and many other new code editing features. We also added support for Shell scripts and Kustomize for Kubernetes, as well as support for the new features of Go 1.13.

If you haven’t checked out these new features yet, visit our what’s new page for the detailed description, GIFs, and screenshots.

We would like to say THANK YOU to the people who help us further improve GoLand by sharing their product experience, feedback, and suggestions with us.

The most active evaluators are getting a free 1-year subscription for GoLand and a special edition of our branded T-shirt!

Meet these wonderful folks:

  • Roland Illig (YouTrack username: roland.illig)
  • Sergey Savenko (YouTrack username: deadok22)
  • Max Neverov (YouTrack username: nmax)
  • Denis Cheremisov (YouTrack username: sirkon)
  • Andrey Sokolov (YouTrack username: falconandy)
  • Gabriel Nelle (YouTrack username: nelle)
  • Mike Schinkel (YouTrack username: mikeschinkel)

GoLand 2019.3 Roadmap

Please note we don’t guarantee that all of the features below will be included in GoLand 2019.3.

Long story short, the GoLand 2019.3 update will be a little different from our previous releases. We realized that since GoLand’s first release, when it turned from a plugin for IntelliJ IDEA into an independent IDE, we’ve been adding more and more new features and extending the existing functionality in many different ways. Now it’s time to exhale and look around.

For this release period, our primary task is to fight bugs, glitches, unexpected behavior, and eliminate anything confusing. We believe that GoLand should bring you, our users, only pleasant experience and be your trustworthy helpmate in the Go world.

However, we couldn’t resist but add something new. Let’s have a look at our plans!
Continue reading

Posted in Roadmap | Tagged , | 3 Comments

Say Hello to GoLand 2019.2!

GoLand 2019.2 has enhanced its debugger in several ways: now it supports function calls during the debugging session, and displays the result of simple String(), Error(), and DebugString() method implementations in the Variables pane. In other big improvements, the Default & Darcula color schemes are polished, customizable Postfix Completion templates are available, and smarter Go Modules and dep integration are here too.

blog@2x

On top of that, we’ve added support for the new features introduced in Go 1.13, various quick-fixes based on the Change Signature refactoring, and many new code editing features. Support for Shell scripts and Kustomize for Kubernetes is available, and last but not least, the Extract Method refactoring can now handle code with return statements.

Download GoLand 2019.2

However, that’s not all we’ve added! Read on for highlights in this blog post, or go to the What’s New page to learn more about what we’ve done with screenshots and GIFs.

If you haven’t tried GoLand yet, this is a great moment to start your free 30-day trial to evaluate the new features – polished and hot off the press.
Continue reading

Posted in Releases | Tagged , | 6 Comments

GoLand 2019.2 Reaches Beta

The upcoming GoLand 2019.2 has reached the Beta milestone today! This means that we’ve stopped adding new features for this release cycle, and are now focusing on polishing everything that’s destined for the release build. The Beta is quite stable in comparison to our Early Access Program builds, but it may still contain some clumsiness.

Download GoLand 2019.2 BETA

There’s enough time to smooth out any rough edges though, so if anything rubs you the wrong way, do speak up! We want to hear about your experience. Even if you don’t come across any bugs or difficulties, we’re happy to chat about whatever or just say hello. Write something in our YouTrack, tweet us, or ping us right here in the comments. Your opinion matters to all of us at GoLand.

blog@2x

Click on a topic below to learn more about a specific area you’re interested in, or read through the whole blog post to get yourself up to speed with all the latest enhancements.

Continue reading

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