GoLand 2021.1

Crie e execute seu programa remotamente via Docker, SSH e WSL 2.
Abril 13, 2021 - 8:40
Nova versão

Funcionalidades

Run Targets

  • You can develop on your machine, with all the source code available to you locally and target remote computers to run your code. The IDE currently supports Docker, SSH and WSL 2 (Microsoft Windows Subsystem for Linux).

Go 1.16

  • Support for //go:embed
    • Added to embed files and directories into a Go binary at build time. Embedding works on a few types of variables: string, []byte and embed.FS. You need to declare these variables at the top level of your package. You then need to add the //go:embed directive for embedding to work.
    • GoLand provides code highlighting, navigation from references inside the embed directive to files and folders in your project, Rename refactoring, Find Usages, code completion and a few code inspections.
  • Detecting incorrect usages of (t/b).Fatal - GoLand warns you about invalid calls to the testing.T method Fatal within a goroutine created during the test. The dedicated quick-fix will rewrite the code calling t.Fatal (or a similar method) so that it signals the test failure using t.Error and exits the goroutine early using a return statement.
  • Detecting incorrect usages of asn1.Unmarshal - In Go 1.16, go vet detects incorrect usages of asn1.Unmarshal, making sure that the value in which a slice of bytes is un-marshaled is not nil. GoLand 2021.1 provides a similar check with a quick-fix to resolve this problem.

Working with JSON

  • Added the ability to generate a struct with fields and tags from JSON in no time by simply copy-pasting JSON data into the editor. It is also possible to convert JSON inside an already existing empty struct.
  • GoLand will notify you if you use invalid JSON code in the Generate Go type from JSON window.
  • Improved creating JSON and XML tags for all the exported fields in the struct - When you use Alt+Enter to invoke Add key to tags on the struct or on any field in the struct, GoLand adds a tag to all fields in the struct with field names. If you want to change the style of the field name for all tags, press Alt+Enter again on any key and choose Change field name style in tags. The supported styles are fieldName, FieldName, field-name and field_name.
  • You can update all tag values at once with the Update key value in tags intention action. Press Alt+Enter on any tag value in your struct and GoLand will add carets at the end of the tag values in every field.
  • The IDE also provides a completion for well-known tokens inside tag values provided by SDK for JSON, XML and ASN.1 code.
  • JSON Lines support - Added support for the newline-delimited JSON Lines format, which is used for working with structured data and logs. The IDE will recognize .jsonl, .jslines, .ldjson, and .ndjson file types. Files in these formats contain several lines and each new line is a JSON object separated by a newline character. Commas are not required at the beginning or end of lines, and there is no need to enclose the entirety of the file contents in square or curly braces.

Handle errors with ease

  • Added several quick-fixes to the Unhandled Error code inspection:
    • The Handle error quick-fix assigns call results to variables and generates an if error not nil check.
    • The Wrap error handling in a closure quick-fix, which is available for defer and go statements, produces code similar to Handle error but wraps everything in a closure.
    • Extended the Ignore explicitly application area to include defer and go statements. The quick-fix assigns the call results to blank variables and wraps everything in a closure.

More quick-fixes

  • Quick-fix for type incompatibility inside composite literals - Expanded the application area of the quick-fix that addresses type incompatibility. It now also suggests implementing an interface and converting to the expected type inside composite literals.
  • Create Type quick-fix generates missing fields - The Create Type quick-fix offers not only to create a type when GoLand notices you are using one that has not yet been defined, but also it will create fields for you as well.
  • Generate all getters and setters at once - You can now generate getters and setters for the whole struct all at once. Press Alt+Enter on any field name in the struct, then choose Generate getter and setters from the drop-down menu. GoLand will then open the Select Fields window, where you can generate get and set methods for all the fields or just for the fields you need.

Refactorings

  • The Extract Type refactoring - Lets you extract a type from an existing one or convert an anonymous structure type to a named type.

Go Modules

  • Rename refactoring for the go.mod file - Added the Rename refactoring to the go.mod file which allows you to rename the module with a new name safely, without needing to do a search and replace in the project tree to replace the old module name.

Postfix Completion

  • New varCheckError Postfix Completion - Type .varCheckError after an identifier that returns an error and the IDE will automatically add default variable names and return the error from the function.

Formatter

  • The built-in formatter can now group imports into separate blocks.

Run & Debug

  • Added the ability to run an extended sudo session. On the first run, GoLand will ask whether you want to keep sudo running or terminate it immediately.
    • Please note that by enabling this option you grant GoLand and all third-party plugins access to your system.

Code Completion

  • Enabled Machine Learning-Assisted Completion which introduces the early stages of code completion based on machine learning (ML), which is an alternative to the standard ranking mechanism.

UI improvements

  • Quick Access Menu - The Configuration widget, which was previously available in the bottom left-hand corner of the IDE, has been replaced with a quick access menu. This new menu appears in the top right-hand corner. Press the gear icon to switch themes or keymaps, navigate to plugins or go to the settings.
  • Quick access to recent projects on Windows via the 'Start' menu - You can now access your recent projects by right-clicking on the GoLand icon on the taskbar or on the Start menu in Windows.
  • Better tooltips display - Tooltips are now shown one after another to prevent them from overlapping.
  • Font variations - You can now select the font variations from the Font settings panel.

Other changes

  • Built-in HTML preview - The new built-in browser preview allows you to preview HTML files quickly. If you make any changes in HTML or if you change the linked CSS and JavaScript files, the preview will update on the fly.
  • Maximize tabs in the split view - Whenever several tabs that split the editor vertically are open, you can double-click either of them to maximize the editor window for that specific tab. To bring the window back to its original size, simply double-click it again.
  • Makefile Language plugin - The Makefile Language plugin (previously 3rd-party), which provides GNU Make language support, is now bundled by default. The plugin provides make syntax highlighting, quick documentation, Find Usages for targets and a variety of navigation and code completion actions for Makefile.

Code With Me

  • Code With Me, a new JetBrains service for collaborative development and pair programming, is now bundled with GoLand. Set the needed level of access to your project and share the link with your guests. Your peers do not even need to have their own IDEs installed to collaborate with you. Embedded audio and video calls, along with chat messaging, will help teams discuss the code, share their knowledge and cooperate more efficiently. For businesses that require extra-security, Code With Me on-premises can be installed and securely run on a company’s own private network.

Docker

  • Improved Run/Debug Configurations - Improved the Run/Debug Configuration dialog in several ways:
    • To add all the necessary build options, click Modify options; to add run options, click Modify. The IDE now validates each option to make sure it is compatible.
    • For Docker-compose, all the existing options are supported, including the one for declaring Environmental variables files (.env).
    • For Dockerfile, you don’t have to remember all the run commands because code completion works in the Run Options field.
    • For Docker Image, you can use code completion to enter the name of the image in the Image ID or name field.
  • BuildKit support - Added experimental support for BuildKit, which makes building projects much faster.
  • UI enhancements in multi-stage Dockerfiles - If you use multiple FROM statements in your Dockerfile, each FROM instruction starts a new stage. In this release you can now fold stages and see a distinct separator line between them.
  • Cancel Docker run - If you decide to stop a running Dockerfile, you can easily do so in the Services tool window. Select the running item, call up the context menu and click Stop Deploy.
  • Environment variables and macros for Docker mounts - When using bind mounts, you can now enter a path to a directory on the host machine faster. The completion mechanism allows you to select macros and environmental variables in the Bind mount option in Run/Debug Configurations.
  • Images completion in Dockerfiles - Added completion for image names.

Web development changes

  • Bundled MDN documentation - MDN documentation is now bundled with Rider which will help prevent connectivity issues with the MDN website and make in-editor documentation in your HTML, CSS, and JavaScript files display more quickly.
  • Improved support for Stylelint - Inspecting your CSS code with Stylelint is now easier. Hover over a problem in your file or place the caret on it and press Alt+Enter, then select Stylelint: Fix current file. You can also now specify a path to the configuration file under the corresponding field in Preferences/Settings.
  • Selector specificity for CSS - When working with style sheets, you can now check the specificity of your selectors.

Work with databases

  • Better sorting - Improved data sorting:
    • A new ORDER BY field works similar to the WHERE field (which was called Filter before): enter a working clause to have it applied to the query of the grid.
    • If you want to use sorting on the client side (which means GoLand will not rerun the query, but will sort the data within the current page instead), uncheck Sort via ORDER BY.
    • The sorting is not ‘stacked’ by default. If you click on the name of a column you want to use to sort data, the sorting based on other columns will be cleared.
    • It’s also possible to open tables with predefined sorting based on the numeric primary key.
  • Context live templates - Added a solution for generating simple statements straight from the database explorer – live templates.
  • UI for grants - Added a UI for editing grants when modifying objects. The Modify user window now has a UI for adding grants to objects. These updates are available for PostgreSQL, Amazon Redshift, Greenplum, MySQL, MariaDB, DB2, Microsoft SQL Server, and Sybase.
Run Targets

GoLand

Um IDE multiplataforma construído especialmente para desenvolvedores Go.

GoLand também está disponível em:

Tem alguma pergunta?

Chat ao vivo com nossos especialistas de licenciamento de JetBrains.