Refactorings in GoLand: Rename refactoring

This is the last blog post in the series of refactorings so I wanted to save the most used refactoring the IDE has for last.

It’s one of the most powerful tools that I use and it works like magic every time. You might think that renaming things is pretty straightforward, but there are some lesser-known use cases which can really boost your productivity that I want to cover today.

But first, let’s start with this example code:

Let’s say that we want to rename the Position field to be a bit more explicit, like “JobTitle”.

We can press Shift+F6 and start renaming the field, press Enter when we are done, and that’s it.

Refactorings - Rename

However, if we change our example slightly to include a JSON string and try to call the refactoring again, then the IDE will suggest renaming the JSON field as well.

This is because the IDE understands that our string is of type string and can perform the Rename operation inside strings as well.

As with the other refactoring features, you can reject renaming the field at any time by selecting the usage you want to omit and pressing the Delete key.

If you press Shift + F6 twice, then you’ll get the following dialog which further allows you to configure where the rename operation takes place and how it should behave.

Refactorings - Rename 2

Since conflicts can appear during the rename operation, the IDE will also handle this for you and allow you to correct this before the code becomes polluted by an accidental naming collision.

Refactorings - Rename 3

This is not all. The rename operation is available across a wide range of languages and support tools as well.

For example, if we connect the IDE to a database, then it can also rename database fields directly from the query that we have.
We can see this in action in the example below:

Refactorings - Rename 4

To learn how to connect the IDE to a database, you can visit our documentation.

This concludes our short series on IDE refactoring tools. We went from changing function signatures to moving identifiers across files and even packages, to renaming them along with any other reference and even with database fields.

I hope you will find this series useful and it will increase your productivity whether you are just starting with Go, you are new to GoLand, or you are a more experienced user. In case you missed our previous posts, here’s the list of the previous topics in the series:

– Rename
Move & Copy
– Extract variable/constant
– Extract function/method
– Inline variable/constant
– Change Signature

Please let us know in the comments section below, on Twitter, or on our issue tracker your thoughts on this and what other topics we can handle in the future.

Feedback on the IDE itself is also welcome and we look forward to hearing from you on how to make your experience more enjoyable and productive.

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

GoLand 2018.3.1 is available for download

A more polished version of GoLand 2018.3, GoLand 2018.3.1, is already available for download. Get this update on your machine in one of three ways: download from the website, update via Toolbox App, or apply as a patch on top of 2018.3 (use Help | Check for Updates).

This update contains bug-fixes in different areas. We recommend that you upgrade and get your IDE working even smoother.

Download GoLand 2018.3.1

Continue reading

Posted in Releases | Tagged , | Leave a comment

What’s Next: Roadmap for GoLand 2019.1

Two weeks ago we released GoLand 2018.3 which introduced a new Change Signature refactoring, debugging for Google App Engine apps, the ability to analyze core dumps, and support for Testify and Mozilla rr. It also improved code completion, added new code inspections and intention actions, and more.

If you haven’t checked out these new features yet, head on to our what’s new page. Or, if you prefer watching rather than reading, we also have this short 5-minute video for your viewing pleasure.

Over these two weeks, we’ve sorted out your feedback and discussed the features that we want to deliver in the next major version. Let’s go behind the scenes and take a sneak peek at what GoLand 2019.1 will likely bring.

But before we do that, we’ll continue our tradition of saying a heartfelt THANK YOU to all our evaluators! These kind people help us deliver a better IDE with each release and each EAP build, telling us about their product experiences and giving us their candid feedback and suggestions.

Today, we’d like to specially mention these wonderful folks:

  • Sergej Zagursky (YouTrack username: g7r)
  • Roland Illig (YouTrack username: roland.illig)
  • Stuart Carnie (YouTrack username: scarnie)
  • Denis Cheremisov (YouTrack username: sirkon)

As a token of our gratitude, each of you is getting a free 1-year subscription for GoLand! Use it to extend your current subscription or start a new one. You will receive an email with a coupon code and instructions on how to redeem it. Ping us if you don’t!

Now on to our roadmap!

Please note we can’t guarantee that all of the features listed below will be included in GoLand 2019.1.
Continue reading

Posted in Roadmap | Tagged , | 11 Comments

Refactorings in GoLand: Move refactoring

In this blog post, we will cover the Move refactoring option as we continue to explore the refactorings provided by the IDE.

If you want to check out the other articles from this series, you can find them all here (links will be updated as new articles are published):

Rename
– Move & Copy
Extract variable/constant
Extract function/method
Inline variable/constant
Change Signature

This is currently my second favorite refactoring, especially during the phase of the project that needs me to restructure how the code is organized.

With the Move refactoring, you can take any top-level named identifier from your source code and move it either to a separate file or to an entirely different package, existing or new.

In the example below, we can see how to move a function declaration to a new file.

Refactorings - Move

The Move refactoring does not only move the declarations, but will also add the required imports, update the references to the identifier, and perform a cleanup of the previous definition place of the identifier so that your code can still work.

Refactorings - Move 2

You can choose to export declarations when using this move, move related declarations, or move multiple declarations at once. And if you want to see which code paths are affected by this change, you can preview the locations that will be affected, with the option to atomically undo everything using the Undo shortcut.

Refactorings - Move 3

That’s it for today. We hope the Move refactoring will become an invaluable tool under your toolbelt if it isn’t already!

As we approach the end of this series on refactorings, we look forward to your feedback both on what we can talk about in future posts, as well as what features you’d like to see in the IDE.

General feedback about the IDE is very welcome, too, so please don’t hesitate to share your thoughts in the comments section below, on our issue tracker, or on Twitter.

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

GoLand 2018.3 released!

blog@2x

Get ready for the Change Signature refactoring, Testify support, and many new tools in the debugger such as Google App Engine, Go core dumps, and Mozilla rr. Find new code inspections and intention actions, improved code completion, support for diagrams, updates for VCS, Docker, Kubernetes, and much more.

Download GoLand 2018.3

To take in all the new features, with GIFs and full descriptions, please visit the What’s New page.

Let’s have a quick look at the highlights of this release.
Continue reading

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

GoLand 2018.3 Beta: Change Signature refactoring, debugging Google App Engine, Testify, Go core dumps, and more

The upcoming GoLand 2018.3 release has reached the Beta milestone!

If you’re new to our release cycles, we announce a Beta when we’ve packed everything we plan to deliver in the major update. Since this moment and until the release date, our team is focused only on polishing everything off.

Download GoLand 2018.3 BETA

Compared with our Early Access builds, the Beta version is quite stable though it may still have bugs and other issues.

20183_beta

Let’s have a look at what the upcoming release will have inside!
Continue reading

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

GoLand 2018.3 EAP 5: better Rename refactoring, Cassandra database support, and JSON enhancements

GoLand 2018.3 EAP 5 is available! Grab your copy from the website, update via Toolbox App, or install it beside your stable GoLand version.

Download GoLand 2018.3 EAP

Continue reading

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

Refactorings in GoLand: Extract and Inline

In this blog post, we will cover the Extract and Inline refactoring options as we continue to explore the refactorings provided by the IDE.

If you want to check out the other articles from this series, you can find them all here (links will be updated as new articles are published):

Continue reading

Posted in Features | Tagged , | Leave a comment

GoLand 2018.3 EAP 4: Mozilla RR, extended code completion, GitHub Pull requests, and more

GoLand 2018.3 EAP 4 is available! Grab it to preview support for Mozilla rr in the debugger, method-like code completion for functions, new gutter icons for shadowed/shadowing (overridden/overriding) methods, GitHub Pull Requests tool window, and more.

Download GoLand 2018.3 EAP

Continue reading

Posted in EAP, New Features | Tagged , , , , | 1 Comment

Refactorings in GoLand: Change Signature

Today, we’re going to start a series of blog posts about an essential part of the development life cycle that happens for any code we write — refactoring.

Thanks to the automation in the IDE, we can perform a lot of refactoring operations in a safe, automated, manner.

As of 2018.3, the following refactoring features are available to use in GoLand are:

Below I am going to talk about a single one, the Change Signature refactoring, with the rest of the refactorings to be discussed in follow-up articles. This feature is new in 2018.3, a version at the time of writing still in the Early Access Program (EAP) stage. A quick description of what EAP stands for can be found in this previous blog post, and you can start using it today.
Continue reading

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