GoLand 2022.1 EAP #3 is Out with New Features for Working with Microservices
Go is undoubtedly one of the most popular languages for writing microservices. In this EAP build, you will find some great features that will make working with microservices easier.
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.
Let’s take a look at our new features and how they can help you.
Find usages and navigate
You will see the changes right away after opening a Go file with the endpoints. Keep in mind that the new features only work with the standard library functions for now. We will consider adding support for some popular frameworks later.
There is now a globe icon next to each endpoint. Click on the icon and GoLand will suggest several options. For instance, you can now find all of the usages of an endpoint and navigate to them. You can also see usages by pressing ⌘ICtrl and clicking on an endpoint.
You can use the Search Everywhere functionality to find the endpoints and navigate to where they are in the code. To do this, click Navigate and then URL Mapping or use the shortcut ⇧ ⌘ \ (Ctrl+Shift+\). Start typing the address of your endpoint to trigger completion.
Generate a request
The second option when clicking the globe icon is Generate request in HTTP client. Choose a corresponding option, and the IDE will open a bundled HTTP client. All you have to do is select an HTTP method from the list and the address.
Our HTTP client has also gotten some updates – you now get code completion for endpoints. Completion works for the endpoints from Go files (only standard library for now), Swagger specifications, .proto files, and JavaScript files.
Start typing your endpoint URL to trigger completion or use the shortcut ⌃ Space/Ctrl + Space to show available completion options.
Once everything’s ready, click on the green triangle in the gutter to run the request or press ⌥ ↩/Alt + Enter to see available intention actions and choose the Run <URL> option.
The response body will be saved to a file that you can access from your HTTP file by pressing ⌘ICtrl and clicking on the response file name.
The Generate request in HTTP client action can be used to generate a request for every valid URL.
Endpoints tool window
The third option is Show all endpoints of module. If you choose this option, GoLand will open the new Endpoints tool window where you can see all the endpoints for your project. The Endpoints window is also accessible via View | Tool Windows. This can be very useful, especially in big projects!
You can Jump to source from here or you can click on every endpoint and run requests right from the HTTP client tab.
There are two more tabs on the right – the Documentation tab that reads the XML documentation found on the endpoint code, and the OpenAPI tab which shows you the OpenAPI specification for the endpoint.
Completion for methods and headers
You now get completion for HTTP methods and headers in Go files.
Links and endpoints are underlined
All links and endpoints in Go files are now underlined so you can easily see them in the code. Links are clickable and can be opened in a browser.
What’s new in 2021.3
Let’s take a look back at the features we added in the previous version.
Support for gRPC
Starting from version 2021.3, GoLand’s HTTP client supports gRPC requests. You can automatically generate a request, and code completion for gRPC requests is available in the client.
You’ll find more details about gRPC support and some other features in this blog post. You can also refer to our Help page.
Swagger support
When you have a valid OpenAPI specification open, GoLand suggests generating code from it.
You can use the Endpoints tool window to see all of the endpoints defined in your OpenAPI specifications and run requests from this window.
Finally, Swagger UI is available to run requests.
More details about OpenAPI and Swagger can be found here.
Tests in HTTP files
Another useful addition – you can write tests in JavaScript right in HTTP files.
We hope you’ll find these updates helpful in your development workflow. As always, your feedback and comments are appreciated! Get in touch with us on Twitter, leave your comments here, open an issue in our tracker, or drop us a message in the Gophers Slack #goland channel. Thanks!