GoLand 2021.3 EAP #6: Type Inference for Generics, Remote Development, gRPC Requests in the HTTP Client
GoLand 2021.3 EAP #6 is available.
You can get the EAP build via the Toolbox App, download it from our website, use a snap package (for Ubuntu), or from inside GoLand, select Check IDE updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.
Type inference for generics
Generics are coming to Go. Unless something changes drastically, type parameters will be available in Go 1.18, which should be released in February 2022.
We began working on supporting type parameters in GoLand some time ago. In this build, we’re ready to give you type inference for generics.
Currently, it is mostly invisible from the perspective of a user, as IDE subsystems such as inspections, completion, and others need to be updated to recognize instantiated types. This will be our next step, so stay tuned!
Remote development with JetBrains Gateway
We have a big announcement this week – GoLand now supports remote development! We have to warn you, though, that this is an early preview, meaning the functionality is still unstable. Also, we can’t guarantee that remote development for GoLand will be fully supported in 2021.3; it might take us a little longer to polish it up.
With that disclaimer out of the way, let’s see how it works. Support for remote development is provided through JetBrains Gateway, our new application that allows you to deploy and run the IDE on a remote server.
With JetBrains Gateway you can:
- Develop on any machine. Software developers are not limited by the power of their local devices – they can use as many resources from their remote machine as needed.
- Take advantage of a flexible environment configuration. Remote development environments can be separated from your local machine configuration. This can help avoid version conflicts and aid you in navigating between workspaces.
- Have source code–free laptops. No source code is hosted on the developer’s machine when they are using the remote development workflow. The company’s data remains secure in authorized repositories.
- Work securely from anywhere. The remote development functionality supports working from home and hybrid schedules, with your projects securely located on the remote machine and accessible from anywhere.
Below is a brief overview of how to get started with JetBrains Gateway (or you can find more detailed instructions on this page).
How to use JetBrains Gateway
Download JetBrains Gateway from here and install it. Open the application and click Connect via SSH.
If you’ve previously configured an SSH connection (such as for a run target), you can select the connection from the dropdown list.
If not, set up a new connection by specifying the username and the host address of the remote machine you want to connect to (change the port if you’re not using the default port 22). Then click Check Connection and Continue.
JetBrains Gateway will then ask you for the password (if you use one) to connect to your remote machine.
Then you’ll need to enter your SSH key passphrase, if you configured one when you created the SSH keys.
Finally, you will see a window where you can select GoLand from the dropdown menu. Enter the path for your Go projects and click Download and Start IDE.
HTTP client enhancements
In this release cycle we have significantly improved the HTTP client. We added support for gRPC requests, output redirection to a custom file or directory, support for text and JSON streams, support for HTTP request identifiers, and support for binary responses. Let’s take a closer look at these new features.
gRPC requests in the HTTP client
GoLand’s HTTP client now supports gRPC requests. Simply start your requests with the GRPC keyword to have the HTTP client treat them as gRPC requests.
The HTTP client now provides completion for gRPC: all known gRPC services, unary and server-streaming methods of a particular server, and, most importantly, fields of accepted messages in the request body.
You can automatically generate a gRPC request in the HTTP client by simply clicking on the gutter icons in your .proto files.
Currently the supported RPC types that can be executed in the HTTP client are unary and server-streaming. Like in ordinary HTTP requests, the request body and responses are plain JSON files.
Support for text streams and JSON streams in the HTTP Client
It is now easier to test streaming applications in your favorite IDE because the upcoming release supports the following content types: text/event-stream, application/stream+json, and application/x-ndjson. This means the HTTP client will no longer wait for a stream to end and will instead display the output on the fly.
The HTTP client will also listen for the end of a stream and will show a message when the process is finished.
Binary responses in the HTTP client
In the upcoming release, the HTTP client shows an image preview in the response console if a response is an image.
The HTTP client does not show a preview for a response if it isn’t clear whether it is a text response.
Output redirection to custom file or directory
The HTTP client can now redirect output to a custom file or directory. It supports two operators for force and soft redirects:
- The >> operator always creates a new file, adding an -n suffix to a file name if the requested file name already exists.
- The >>! operator rewrites the file if it already exists.
Support for HTTP request identifiers
GoLand now understands identifiers (or names) for requests. It understands identifiers that were declared as a comment with @name, as well as those declared as text in the first separator (###).
You can invoke a request by its identifier from the Services tool window or from the Run Configuration, Run Anything, or Search Everywhere dialogs.
Support for URLs in import statements in ES6
You can now download remote ES6 modules using a quick-fix on the import path in ES6 files. The module with all its dependencies will be downloaded and linked as a project library. The functionality should work the same way it does in the browser. To give it a try, place the caret on the import path, press ⌥↩ (Alt+Enter), and then select Download module.
Source preview for Show Usages
The Show Usages feature (⌥⌘F7 / Ctrl+Alt+F7) has received a small yet handy improvement in this release. You can now turn on the source code preview for a found usage by clicking the square icon.
Update on the new Run / Debug UI
In the first EAP, we introduced a new UI for the Run and Debug tool windows. Since then, we’ve collected a lot of feedback from you and realized there’s still quite a bit of room for improvement.
We’ve decided to bring the old layout back for now and continue to polish the new UI. The only thing that is left from the new UI is the updated implementation of the Evaluate Expression feature – you can still use it right from the Debug tool window, without opening a separate dialog.
If you prefer the new UI, tick the debugger.new.tool.window.layout flag in the Registry. To open it, invoke the Search Everywhere pop-up with ⇧⇧ / Shift+Shift and look for Registry there.
That’s it for today! Let us know what you think about the new features. Leave your comments here, tweet us, open an issue in our tracker, or drop us a message in the Gophers Slack #goland channel. Thanks!
Subscribe to Blog updates
Thanks, we've got you!
The GoLand 2023.3 Early Access Program Has Started!
The Early Access Program for GoLand 2023.3 is now open!
GoLand 2023.2 Reaches Beta!
The Beta provides all of the new features and improvements already announced during our current EAP cycle.
GoLand 2023.2 EAP #7: LSP API Support, and HTTP Client Improvements
This build includes support for LSP API and improvements for HTTP Client.