GoLand 2022.2 go.work
brings new features to Generics and also adds support for fuzzing, SQL statements are now auto-detected, and comprehensive code assistance for them.
GoLand now supports WebSocket connections and can send GraphQL queries over HTTP and WebSocket protocols.
Generics
any
Intent action to convert empty interface to
GoLand's new check can report empty interface usage as a type or type constraint.
Another intent action is to interface{}
replace with any
. From the intent action's popup, you can replace all empty interfaces in the file.
Quick fix for removing type parameters with empty parameter lists
Type parameters with empty parameter lists are now reported as errors, and a quickfix to remove them has been added.
Checking for unused type parameters
GoLand 2022.2 adds a new inspection that can report unused type parameters. They will be greyed out and you will see a warning when you hover over them.
Check for union of interface and method
The IDE now reports an error if you try to use an interface with a method in a union.
Checks for using type parameters as constraints
GoLand will display an error if you try to use a type parameter as a constraint.
Completion for type parameters when entering a method's receiver
When a receiver is added during method creation, GoLand automatically inserts identifiers for type parameters.
New Find Usages group for type parameters
GoLand 2022.2 introduces a new Find Usages group for generics: type parameter declarations.
Fuzzing
run fuzz tests
Fuzzing tests can now be run from GoLand. If you click on the green triangle icon in the space next to the fuzz test, you will see different options for running the test. If the test fails, the failed seed corpus entry will be written to a file and placed in testdata
the package directory of the folder.
The path to this file will also appear in the console as a clickable link. If you click this link, the file will open in the IDE with a green triangle icon at the top of the file. Clicking this icon will run go test
and display the failed seed corpus entries.
It is also possible to run fuzz tests from GoLand just like normal unit tests.
A quick fix for changing the Go SDK
In GoLand, if a Go SDK is configured that does not support fuzzing, the run button will no longer appear in the gutter. GoLand 2022.2 adds a quick fix that changes the Go SDK when the current Go SDK doesn't support fuzzing.
Go workspace
Quick fix for grouping multiple use
instructions
Added a quickfix that combines go.work
multiple use
instructions into a single instruction.
Go 1.19
right fmt.Appendf
support
With added fmt.Appendf
support for , GoLand now recognizes formatting verbs in strings. Therefore, Appendf
functions can take advantage of all the functionality that formatting functions have, such as the Add a format string argument intent operation.
Support for unix
build constraints
GoLand now supports new unix
build tags that recognize any Unix or Unix-like system.
loong64
Add to Arch List
Go 1.19 introduced a new architecture loong64
. We've added it to the Arch list under Preferences | Go | Build Tags & Vendoring (Settings | Go | Build Tags and Vendoring) .
quick documentation
Improved Quick Documentation :
-
GoLand now displays meaningful keyword tooltips for each of the 25 Go keywords, outlining the semantics of the associated keyword.
-
Channel orientation information is now displayed. This data is displayed in tooltips in three places: when you hover over a
chan
keyword, when the channel is performing send and receive operations, and on all references to the channel type. -
iota
The Quick Documentation now contains additional information on how to use it. If the constant isiota
part of a group, the value is now displayed in the completion box, even if the constant is implicitly defined. -
There is also a new tooltip explaining how the type switch works.
-
If Quick Documentation is invoked on a type parameter , GoLand will display a tooltip that briefly explains how generics work and provides links to tutorials by the Go team.
-
Tooltips for type assertions now contain additional relevant information and provide examples.
-
GoLand displays additional information when you initialize maps, arrays, slices, and structs if you hover over the area within the curly braces.
-
When you hover over a blank identifier, GoLand displays a tooltip explaining the blank identifier and how it works.
More Go related improvements
performance optimization
GoLand no longer scans subdirectories ~/go/pkg/mod
in cache
, because the latter do not contain the information needed for the IDE to function properly. This folder can be quite large and excluding it from scanning should improve performance.
support for go:linkname
directives
Added support for go:linkname
compiler directives:
//go:linkname localname [importpath.name]
It instructs the compiler to use the object file symbolic name importpath.name
as a variable or function declared in the source code .localname
iota
Unusual usage check
A new check has been added to GoLand that iota
will warn you if the usage is unconventional.
The Reserved word used as name check is also iota
enabled for and other built-in constants . A check is triggered when an attempt is made to assign a value to a constant named , or .iota
true
false
Checks for methods on value and pointer receivers
The Go documentation recommends that all methods on a given type should have value or pointer receivers.
A new check has been added to GoLand that will warn if the type has methods on both value and pointer receivers.
Automatic SQL detection
SQL statements can now be auto-detected, and the language will be injected into every string literal that matches a specific pattern. When injecting language into a string literal, if you edit that literal, you get full code assistance.
You can find, edit, and add your own patterns in Preferences | Editor | Language Injections .
run anything
GoLand now supports the Run Anything action, which lets you quickly launch run/debug configurations, applications, scripts, commands and tasks, as well as open recent projects. Just press ^ twice and enter what you want in the search bar.
HTTP client
Support for WebSocket endpoints
GoLand now supports WebSocket connections. You can create requests and send and receive messages.
Support for GraphQL endpoints
GoLand can now send GraphQL queries natively over HTTP and WebSocket protocols. For http://
sums https://
, simple HTTP requests are used, ws://
and wss://
sums are delegated to the WebSocket executor.
Choose the operating environment
There is now a new way to select the runtime environment on the play icon in the Gap. To enable this feature, select the Select Environment Before Run option from the Run with combo box .
Remote development
Updated the Remote Development section of the GoLand welcome screen . Here you can choose your preferred method for backend orchestration. Additionally, port forwarding is now available for processes running on the terminal.
Space
JetBrains Space is a complete software development platform that provides project management, issue tracking, Git hosting, code review, continuous integration, package repositories, and remote backend orchestration for the JetBrains IDE throughout the development environment.
Space integration is now bundled with GoLand. With this first-class integration, you can browse Space projects and clone repositories, and get right to work. When the changes are in place, you can create merge requests and perform code reviews in the IDE.
The Space development environment for remote development can now be managed directly in GoLand
When an IDE is associated with a Space organization, all existing development environments are synchronized. You can create new development environments for repositories and branches and start coding right away. The development environment can be hibernated to reduce resource consumption, or simply deleted when the work is done.
User Interface
Merge All Project Windows action on macOS
Introduced a feature for macOS users to merge all open project windows into one, turning it into a tab. Go to Window | Merge All Project Windows to enable.
Keyboard shortcuts to change font size
Introduced a keyboard shortcut that changes the font size everywhere in the editor. To increase the font, press ⌃⇧.. To reduce the font, press ⌃⇧,
When zooming in or out of code in the editor, you can now see an indicator showing the current font size and an option to restore it to the default.
New Description field for mnemonic bookmarks
The Description field has been integrated into the Add Mnemonic Bookmark dialog, so an optional description can be added to the bookmark. To add a mnemonic bookmark, right-click the space next to the row you want to bookmark and select an option from the context menu. Or use the shortcut key ⌥F3.
Cloning repository progress bar
The Cloning repository progress bar is now displayed directly in the Projects list.
Faster access to Code Completion Settings
Code Completion Settings can now be accessed from the vertical ellipsis menu button of the code completion popup .
editor
Control automatic parenthesis insertion
We've added an option to toggle whether the IDE automatically inserts parentheses during code completion.
Change the highlighting style of inspections
The highlighting style for inspections can be adjusted using the new Highlighting in editor drop-down menu in Preferences | Editor | Inspections .
This gives you more options for customizing checks. For example, you can set the severity level of a particular check to Warning , but change the highlight style to Error .
Docker
Copy the Docker image
Images can now be copied from one Docker daemon to another using the new Copy Docker Image action, which saves the image to a file and then pushes it to the selected connection.
Docker automatically connects when IDE restarts
现在,重新启动 IDE 后,GoLand 会自动连接到 Docker。这一新设置在 Preferences | Advanced Settings | Docker(设置 | 高级设置 | Docker)中默认启用。
与 Colima 和 Rancher 的集成
GoLand 现在与 Colima 和 Rancher 集成,支持更多用于建立与 Docker 守护进程的连接的选项。
数据库
导入多个 CSV 文件的选项
现在可以选择多个 CSV 文件并一次全部导入。
数据库的解析模式
使用数据库时,现在拥有两种文件解析模式:Playground(演练场)和 Script(脚本)。
Playground(演练场)适用于有一组未连接查询的情况,而 Script(脚本)适用于具有顺序逻辑的查询。
其他改进
导入受信任的 SSL 证书
GoLand 现在可以帮助您从系统受信任存储区导入受信任的 SSL 证书。它将自动使用特定于企业环境的自定义证书。您无需执行任何其他操作。一切都开箱即用。
JSON 和 YAML 文件中的可点击 URL
JSON 和 YAML 文件现在会在以 http://
和 https://
开头的值中自动插入 Web 引用。您可以在 Web 浏览器中打开这些链接并在 HTTP 客户端中生成请求。
看完本文有收获?点赞、分享是最大的支持!