vgo integration support

Package management has long been a topic of interest for many people in the Go community. A few months ago, the Go team put forward a new tool, based on the learnings from dep and other package managers. This tool is called vgo, and it’s backed by a new dependency solving algorithm called Minimal Version Selection, or MVS. All of this is described in great detail in Russ Cox’s blog post series.

Given the importance of this tool, it’s easy to see how the request to integrate it with the IDE quickly became one of the most voted features.

Today we are happy to announce the first version this integration is available as a plugin for GoLand 2018.1.2+. This feature will be integrated by default in the upcoming 2018.2 release.
Continue reading

Posted in New Features | 2 Comments

GoLand 2018.1.3 Update is Here

For a couple of weeks we’ve been rather busy addressing your feedback, and here’s an update to keep you in the loop with what exactly was done. Welcome GoLand 2018.1.3, a fresh update, that, though doesn’t bring noticeable Go-specific improvements, comes with lots of bug fixes and improvements related to the UI and JavaScript and SQL support.

The update is available via Toolbox App, or you can still install it the old way, by using the Check for Updates menu in GoLand itself, or (why not) just download a copy of installer our website.

Here’s the list of most interesting changes that come with this update:

  • For side-effects import statement, code completion now includes non-JavaScript files as well, e.g. CSS.
  • GoLand now displays the type inferred by Flow server as a part of Brief Info that pops up when hovering an expression holding Ctrl or Cmd
  • Angular 6 improvements along with integration with Angular CLI 6 blueprints
  • TypeScript code completion updated according to the TSLint rules
  • Flow support within Vue files
  • Find Usages on SQL files now includes the DDL Data Sources that use them
  • Support for .sqlite/.sqlite3 files
  • Run SQL Script action now available in the Database (on a data source or a scheme) and Project (on the file) tool windows. This action can be used to import data from SQL dump files.
  • Fixed Z-order of child windows that was broken in one of the earlier builds is broken no more.

For more a more detailed report, see the release note.

P.S. EAP for GoLand 2018.2 is around the corner, and it will bring lots of goodies, so stay tuned!

Happy developing!

Posted in Releases | 8 Comments

Debugging containerized Go applications

Containers are increasingly popular for deploying applications and Go applications make no exceptions from this. But how should we debug these applications that are running in the isolated environment a container offers?

For this, we turn back to the way we build these containers and include a copy of Delve, the Go debugger, and we adjust how we create/launch our application.

Let’s consider a basic web application:

We’ll place the code above in a package under GOPATH, for example $GOPATH/src/hello/hello.go

One important note is that your project should be in a valid Go Workspace, also known as GOPATH. You can read more about Go Workspaces in the official documentation.

Before we continue, make sure you have installed the latest Docker plugin from our repository via: Settings | Plugins | Install JetBrains Plugin… | Docker integration.

Now, let’s start using Docker to compile and run this application.

We have a simple, multi-stage, Docker container which contains the building stage and the final container that results from this.

Place this in the root of your package, in our example under $GOPATH/src/hello/Dockerfile.

To run this, we’ll have to create a new Run Configuration, and expose our application’s port, 8080.

Application Run Configuration

To test this, we’ll run the container and then launch a simple request from the IDE. To run requests from the IDE, you can create a file with the “.http” extension and then type the request as below:

Debug Container - Run Application

Let’s transform this container into one that can be debugged. Our goal is to keep as much parity as possible with the original container so that the functionality is not affected by our debugging version.

We must first compile our application with all optimizations turned off, to allow Delve to extract as much information as possible from the binary. The second part involves actually running delve into the container.

Before we can continue, we also need to add two more options to the Docker Run Configuration from earlier. First one, we need to expose the port we’ll send and receive data from Delve, port 40000. The second one will be to allow delve to debug the application inside the container, –security-opt=”apparmor=unconfined” –cap-add=SYS_PTRACE.

Run Application with Debugging Settings

GoLand will automatically map the source code location for us, so even our source code is on an operating system, and we are compiling/using the binary on a different operating system, everything will work without having to do anything special for this case.

After running this container configuration, now the last step is to connect to the debugging container and see the debugger working. Run our container and then go to “Run | Edit Configurations…” and add a new Go Remote configuration, fill in the remote host IP and port number and then run it like any other configuration.

Remote Debugging Configuration

Rerunning a request will stop the debugger as expected and you can see all the values as if you would debug a local running process.

Debug Container - Run Application with Debugger

And that’s it. Using GoLand’s debugging facilities, you can debug not only applications that run on your machine but also applications that run on remote computers or even in containers. And if you are using Kubernetes, you can also install a plugin to help you edit Kubernetes resources.

If you have not done so already, download GoLand today and send us feedback in the comments below or using our issue tracker on how we can further improve your development experience!

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

GoLand 2018.1.2 is Out

It’s been a while since our last update, but we haven’t been twiddling our thumbs. No, sir. We’ve made some very cool improvements in GoLand, both in Go support and other platform-specific areas. Please welcome GoLand 2018.1.2, a fresh bugfix update!

In this update:

  • The Test Runner now supports ANSI escape codes and colors the output accordingly.

  • The Dep integration had been optimized in terms of when it runs dep status. Now this command is not executed during code editing. Instead, the IDE performs its own checks and suggests running dep ensure based on those.
  • To assist in error handling, our collection of Postfix Completion templates has been updated with two more: rre and rrv. Both generate code that checks if an error variable is not nil and then exits the function by returning default values. The rrv template is applied to variables:

The rre template is applied to expressions returning an error result:

  • The Search for text occurrences check-box, which is offered when calling Find Usages, now keeps the state, and by default is disabled when the action is called on a method.
  • The Join Lines action now works correctly (previously was broken on comments).

The important VCS bug-fixes include:

  • Better performance when scrolling in the Log and when indexing shallow clones
  • A few fixes related to partial Git commits

Also, here’s a list of changes merged from the WebStorm 2018.1.2 release:

  • The Rename refactoring on an Angular component, will prompt you to also rename the related .ts, .html, and .css files. Make sure the Angular plugin is installed and enabled.

  • The Auto Import for the RxJS operators now respects the new import style introduced in RxJS 6.0. For example, instead of import { Observable } from ‘rxjs/Observable’; you should now use import { Observable } from ‘rxjs’.
  • A new option, Ensure breakpoints are detected when loading scripts, has been added to the JavaScript Debug Run Configuration. This option should solve the problem with some breakpoints that are in the code that is executed on page load not being hit before you reload the page in the browser.
  • For JavaScript object properties, when you explicitly check that they exist, you will now get more accurate code completion:

That’s about it. The complete list of changes can be found in the release notes.

Now, once you’ve learned what’s in the update, go ahead and install it. If you use Toolbox App, it can install the update for you. Otherwise, click Check for Updates and if you’re running GoLand 2018.1.1, it will prompt you to install the patch. Finally, the update can be downloaded from the website and installed manually.

Don’t forget to share your feedback here in the comments, or directly in our issue tracker.

Happy developing!

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

Go the Distance: GoLand 2018.1 is Here!

We’re thrilled to announce that GoLand 2018.1 is now available for download.

This release is an important milestone for our team as it’s the first massive update to the IDE since its launch four months ago. The update focuses on making the coding assistance, the IDE is proud of, even smarter, and also on polishing up the integration of many of other tools the IDE runs with along the way. The update supports partial Git commits, integrates Dep, makes it possible to debug local Go processes, improves Docker Compose support, features smart coding assistance for editing Kubernetes resource files, and much more. Here’s a list of the most notable changes:

  • Go
    • Dep integration
    • Run and Debug
      • Attaching Debugger to local processes
      • Running multiple files via Build run configuration
    • Coding assistance
      • Full support for Go 1.10
      • Move refactoring (within a single package)
      • Negate completion
      • New Postfix templates: .if and .p
      • Default values completion
      • Lots of new intention actions and quick-fixes
      • New formatting options and auto-formatting on Enter
      • Optimize imports on-the-fly editor option
      • Reworked Documentation pop-up (now with example functions)
      • Handling imports on Paste and custom templates for Scratch Files
      • Auto-import now works only when the result has no errors
    • Performance
      • The option to not index the entire GOPATH (suitable when using a dep manager)
      • Faster Rename and Find Usages for global symbols
    • Other
      • Better Test Runner (respects tests hierarchy and improves tests output)
  • Git
    • Partial Git commits
    • Abort Rebase, Continue Rebase, and Skip Commit actions in the Branches pop-up
  • JavaScript & TypeScript
    • Full support for TypeScript 2.7
    • Surround with type guard quick-fix
    • Rename provides an option to safely rename the file as well
    • Reformat with Prettier
    • Extract a Vue component refactoring
  • Deployment
    • Docker Compose workflow improvements
    • Smart coding assistance for editing Kubernetes resource files (both JSON and YAML)

To learn about these and other changes in more detail, take a look at the What’s New page.

To download the update, use either the download page or the Toolbox App.

As always we appreciate your feedback. Please share it here in the comments or if you prefer directly in the issue tracker.

Spread the word, and Happy developing!

Posted in New Features, Releases | Tagged , | 17 Comments

GoLand 2018.1 Public Preview is Here

If you’ve been following our recent news, you probably know that for the last three months we’ve been working on GoLand 2018.1 – the next major update of your beloved IDE. During the last two months, the update has been available for early preview with our EAP program. Today, with most of the work finished, we’re happy to announce a public preview of the upcoming update. What does it mean? That from today we’re no longer working on changes and focusing on bug-fixes. It also means the update is ready for mass preview. You’re very welcome to download it and share your feedback with us through our issue tracker. Those of you who use Toolbox App will find the update available there. If you’re curious about what the major changes in the update, read the rest of this post below, and share it with your friends!

Continue reading

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

GoLand 2018.1 EAP 5: Dep Integration, Smarter Auto-Imports, Scratch Files, Faster Rename and Find Usages, and More

A fresh GoLand 2018.1 EAP build is here, and as always, it comes with lots of new features and bugfixes! Below is a quick overview of the changes.

Dep

The most important news about the update is the support for dep, the official experimental dependency management tool. The update is capable of importing existing dep projects and also provides a project wizard for creating new dep projects.

To create a new dep project, open the Project Wizard and switch to the Dep tab on the left-hand side of the dialog:

To create or work with a dep project, you have to fill the Dep location with the path to the dep binary.

If you import an existing dep project, the IDE will detect dep and will prompt you to enable the dep integration:

Now when you work with a dep project and open a file that has an unresolved import statement, the IDE will offer a quick-fix that runs dep ensure:

After you click it, the IDE will run the command and afterward automatically sync the changes in the vendor folder.

The path to the dep location can always be changed in Settings | Go | Dep:

Auto-import

The auto-import mechanism has been made smarter with this update and it now only applies it if the resulting code compiles with no errors (GO-1730). If the resulting code cannot apply without errors, the IDE prompts a quick-fix that adds the corresponding import statement – so you can call it manually.

Code completion

Code completion suggestions for boolean expressions now can be selected and negated by simply pressing “!” (GO-5411):

Scratch files

A scratch file, created from a Go code selection, now gets all proper import statements automatically. If you haven’t used Scratch Files yet, make sure to try them as they offer a “Go Playground”-like editing session with full IDE support.

Misc

The two other minor yet very important improvements are:

  • The global symbols now can be renamed and searched for usages much faster.
  • The inspection that reports type mismatch now respects type aliases (GO-5190 and GO-5408).

Additionally, if you are wondering about support for vgo, the new experimental tool for dependency management, please keep an eye on GO-5390. We will post updates there when we have them.

Last but not least, GoLand 2018.1 now offers a brand new plugin for Kubernetes.

To learn more about the plugin, read its announcement in IntelliJ IDEA’s blog.

That’s it for now. Now go ahead and try all these improvements for yourself! The update can be downloaded from the website, the Toolbox App, or from the IDE if you run the latest EAP build.

Happy developing!

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

GoLand 2018.1 EAP 4 is Here: Partial Commits for Git, Attaching Debugger to Local Processes, and More

Following the train of EAPs of the IDEs based on the IntelliJ platform, GoLand is releasing its own. Welcome GoLand 2018.1 EAP 4. The update brings in the improvements from the platform, such as the long-awaited support for partial Git commits together with Go-related improvements and some new features. Below you’ll find more details. Anyone wanting to just get going with it is welcome to download the update through the website, the IDE, or the Toolbox App.

First, let’s get into the new Go-related features and improvements. The IDE is now able to attach the Debugger to locally running processes (GO-4867). The only thing you have to do is click Run in the main menu and choose Attach to Local Process:

The IDE will prompt you to select a process to debug:

Note, the IDE may also prompt you to install the gops package. When asked, please click to agree to do so in the popup. The IDE will do it automatically. After that, you’ll be able to attach the debugger to local processes.

Once the process is selected, it will open the Debugger tool window and be ready to stop at breakpoints:

Another area of improvement brought by the update is Postfix Completion.

All the templates can now be disabled or enabled. Earlier some of the templates were not present in the Settings (GO-5165):

Here in the list, you will also notice there is the new template “.if” (GO-4094). It’s very convenient to transform an entered bool expression into an if statement:

If a bool expression is a check for nil, make sure to use “.nn” or “.nil” templates instead because they are designed exactly for that.

When a template is applied to a function argument, the IDE sometimes used to apply the template to the function instead of the argument. The update fixes this issue (GO-5125).

Also, the IDE now does not run Example functions within go tests if those functions have no output values (GO-2029). The Gutter icon is also not shown for such functions.

The Go Scratch Files are now created from the predefined templates that can be customized in Settings | Editor | File and Code Templates:

Secondly, let’s now have a look at the platform-level improvements. Yes, you got it right from the intro to this post. This update supports partial Git commits (IDEA-63201).

Now you can choose which individual changes within a file to commit:

Also, now you can assign these individual changes within a file to different Changesets. To do this, click the change marker on the Gutter (the left-hand pane of the editor):

Last but not least, in case you have several repositories configured for the project, the VCS tool window will allow you to group the changes by the repositories. To do that, use the corresponding icon on the right-hand toolbar of the Local Changes tab.

That’s it for now. For the complete list of changes, please check out the release notes. Your feedback as always is welcome here in the comments or even better right in the issue tracker.

Happy developing!

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

GoLand 2018.1 EAP 3: Move Refactoring, Better Test Runner, Go Build, QuickDoc, and More

Great news everyone! A fresh GoLand 2018.1 EAP build is here with lots of goodies inside. Read on to learn what’s in there or go ahead and download the EAP build to try it for yourself.

Thanks to the new -json option introduced in Go 1.10 for go test, the update is able to represent the results of the tests better. Now it supports the hierarchy of tests and correctly attributes the output and compilation errors to individual tests and packages:

With the updated Go Build run configuration now you can select and run multiple files (GO-555). You can either select the files in the run configuration dialog using the Plus button next to the Files field, or select the files in the Project tool window and then choose Run from the context menu:

The Quick Documentation action is now aware of example functions and includes them as part of the documentation (GO-2000):

The family of available refactorings for Go is extended with Move (GO-4088). This refactoring allows you to move any top-level member to another file:

The Undo action when used along with File Watchers, doesn’t offer to undo Reload from Disk anymore (GO-4726). Instead, it simply undoes the latest change, including the change made by File Watchers.

Last but not least, the Auto Import has been made smarter and prevents you from adding undesired import statements (GO-5118).

That’s it for now. For a complete list of changes, please refer to the release notes. Please give the new EAP build a try and share your feedback with us in our issue tracker.

If you’d like to make your life easier and automate managing updates, please consider installing Toolbox App.

Happy developing!

Posted in New Features | Tagged , | Leave a comment

GoLand 2018.1 EAP 2 is Here

Last week we announced the opening of GoLand 2018.1. Today we’re glad to present you with a fresh EAP build with a number of improvements. Read on to learn about them in more detail, or go ahead and install the update in whatever is your preferred way: download from the website, update from the IDE, or update from Toolbox App.

The editor is now able to remove import statements for unused packages on the fly as you type. This is convenient as you don’t have to remove those import statements by yourself anymore. The IDE does it for you:

This option is called Optimize imports on the fly. You can enable it in Settings | Go | Imports:

The Build run configuration earlier didn’t allow you to use -o in the Go tools arguments field. Now it does, and overrides the value set in the Output directory field:

When debugging, the IDE now distinguishes shadowed variables in the Watches and Variables tabs of the Debugger tool window:

The name suggestion algorithm is now aware of the context and avoids name collisions, e.g. when extracting variables.

Some of the inspections that correspond to go vet and which are supposed to run before go test in Go 1.10 were improved. A few examples are given below:

1) In the following case, the IDE doesn’t offer to simplify the second part of the boolean expression:

2) The IDE warns about type mismatches for the calls of fmt.Printf:

3) The IDE reports invalid build tags:

And last but not least, if you now click Enter when the caret is on a chain call or a string literal, the IDE auto-formats the resulting code:

That’s it for today. For a more complete list of changes in the build, refer to the release notes.

As always, your feedback along with bug reports and feature requests is very welcome in our issue tracker!

Happy developing!

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