{"id":150561,"date":"2021-06-04T14:22:14","date_gmt":"2021-06-04T13:22:14","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=go&#038;p=150561"},"modified":"2021-06-18T14:29:42","modified_gmt":"2021-06-18T13:29:42","slug":"goland-2021-2-eap-build-2-is-here","status":"publish","type":"go","link":"https:\/\/blog.jetbrains.com\/zh-hans\/go\/2021\/06\/04\/goland-2021-2-eap-build-2-is-here","title":{"rendered":"GoLand 2021.2 EAP Build #2 Is Here!"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"800\" height=\"400\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/06\/Blog_Image_GoLand-1.png\" alt=\"\" class=\"wp-image-155321\"\/><\/figure>\n\n\n\n<p>GoLand 2021.2 EAP build #2 is out and ready for you to install!<\/p>\n\n\n\n<p>You can get the EAP build via the <a href=\"https:\/\/www.jetbrains.com\/toolbox\/app\/?_gl=1*r6u7kg*_ga*MTMzMTM3NzQ1MS4xNjIxOTM2MTky*_ga_0WQ2ZF5VGT*MTYyMjc5ODA0MS42MS4xLjE2MjI3OTg4NzguMA..&amp;_ga=2.128561929.463726163.1622398163-1331377451.1621936192&amp;_gac=1.257356409.1622733323.Cj0KCQjw--GFBhDeARIsACH_kdYJNa3me-RrM8rVpyFt4Ep5vqVq1MW0ib0F_aqcJRnqwiJVKbB3oFIaAmPDEALw_wcB\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">Toolbox App<\/a>, download it from our <a href=\"https:\/\/www.jetbrains.com\/go\/nextversion\/?_gl=1*19wtq3y*_ga*MTMzMTM3NzQ1MS4xNjIxOTM2MTky*_ga_0WQ2ZF5VGT*MTYyMjc5ODA0MS42MS4xLjE2MjI3OTg4NzguMA..&amp;_ga=2.165313978.463726163.1622398163-1331377451.1621936192&amp;_gac=1.57473368.1622733323.Cj0KCQjw--GFBhDeARIsACH_kdYJNa3me-RrM8rVpyFt4Ep5vqVq1MW0ib0F_aqcJRnqwiJVKbB3oFIaAmPDEALw_wcB\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">website<\/a>, use a snap package (for Ubuntu), or from inside GoLand, select <em>Automatically check updates for Early Access Program<\/em> in <em>Preferences \/ Settings | Appearance &amp; Behavior | System Settings | Updates<\/em>.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><a class=\"ek-link jb-download-button\" href=\"https:\/\/www.jetbrains.com\/go\/nextversion\/\" target=\"_blank\" rel=\"noopener\">Download GoLand 2021.2 EAP #2<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Download modules on demand&nbsp;<\/h2>\n\n\n\n<p>GoLand has the <em>Sync dependencies<\/em> action, which fetches missed dependencies and removes unused ones by calling <em>go mod tidy\/vendor<\/em>. It works a little bit differently with <em>replace<\/em> directives in <em>go.mod<\/em> files.&nbsp;<\/p>\n\n\n\n<p>Earlier, if you specified a module that wasn\u2019t used anywhere in your code (but you still wanted to have it) in the <em>replace <\/em>directive, the IDE wouldn\u2019t download or delete it, and the lines with these unused dependencies would be marked red. It didn\u2019t affect how the application worked, but those red lines have been confusing our users and causing them to look for errors.&nbsp;<\/p>\n\n\n\n<p>This new feature will help resolve such situations. If you run <em>Sync dependencies <\/em>and you still see red lines in the <em>go.mod<\/em> file, click on the red bulb or use <em>Option + Enter (Alt + Enter)<\/em>. You will see a couple of options apart from <em>Sync dependencies <\/em>\u2013 download a particular module or all the specified modules to your cache.&nbsp;<\/p>\n\n\n\n<p>In a future EAP build, we\u2019re also planning to mark differently any modules that are not required by your code or any of its dependencies. These lines will be highlighted as unused.\u00a0\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/06\/download-modules2.gif\" alt=\"\" class=\"wp-image-155835\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Support for generics in .go files<\/h2>\n\n\n\n<p>Last June, the Go team announced a draft design for generics, a.k.a. type parameters. In March 2021, this draft design became a proposal. Generics should be available in the Go 1.18 release in early 2022.&nbsp;<\/p>\n\n\n\n<p>Since GoLand 2020.2, we\u2019ve been providing experimental support for generics. You can play with them by turning on the <em>Enable experimental support for generics a.k.a. type parameters<\/em> setting in <em>Settings\/Preferences | Go<\/em>. The details about how to use type parameters in GoLand are available <a href=\"https:\/\/www.jetbrains.com\/help\/go\/how-to-use-type-parameters-for-generic-programming.html\" target=\"_blank\" rel=\"noopener\">in our documentation<\/a>.&nbsp;<\/p>\n\n\n\n<p>Previously, experimental support for generics in GoLand was only available in files with the <em>.go2 <\/em>extension. It was done this way so that this experiment wouldn\u2019t interfere with the rest of the work. If you wrote some code with generics in <em>.go <\/em>files, the IDE would suggest renaming them with the <em>.go2<\/em> extension.&nbsp;<\/p>\n\n\n\n<p>We now think that experimental generics support in GoLand is stable enough, so with this EAP release GoLand provides support for type parameters in <em>.go<\/em> files, too. It no longer suggests renaming the file, but you still need to enable support for generics in the settings or through a quick-fix.\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/06\/go_files_generics2.gif\" alt=\"\" class=\"wp-image-155857\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Clearer messages about settings mismatch&nbsp;<\/h2>\n\n\n\n<p>This feature suggests an explicit call to action if the settings of the target system in your project don\u2019t match your code.&nbsp;&nbsp;<\/p>\n\n\n\n<p>Let\u2019s say you imported the <em>\u201cC\u201d<\/em> package, which allows calling C code from Go, but didn\u2019t enable <em>cgo<\/em> support in the project settings.&nbsp;<\/p>\n\n\n\n<p>The IDE will suggest <em>Navigate to cgo import<\/em>, which will put the cursor right before the package\u2019s name. You can also <em>Enable cgo support <\/em>with one click without needing to go to <em>Preferences\/Settings | Go | Build Tags and Vendoring.<\/em> As earlier, there is an option to<em> Edit Go project settings. <\/em>It opens a window with the settings for <em>Build Tags and Vendoring<\/em>. <em>\u00a0\u00a0<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/06\/cgo-banner1-1.gif\" alt=\"\" class=\"wp-image-155868\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Find implementations of \u201cinternal\u201d interfaces easily&nbsp;<\/h2>\n\n\n\n<p>Starting with this release, you can <em>Navigate to implementations<\/em> of the interfaces contained in the <em>internal<\/em> folder. To jump to the implementations, click on the gutter. You can also jump back to the interface from its implementations.\u00a0\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/06\/go-to-internal-interface3.gif\" alt=\"\" class=\"wp-image-155879\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Version control improvements&nbsp;<\/h2>\n\n\n\n<p>This EAP release brings you some new pre-commit checks. You can now <em>Run tests<\/em> and <em>Analyze code<\/em> before committing your changes. Go to <em>Preferences\/Settings | Version Control | Commit | Before commit <\/em>or click on the gear icon in the <em>Commit<\/em> view<em>. <\/em>GoLand will show the progress and the results of pre-commit checks in the <em>Commit<\/em> area without opening additional modal windows.\u00a0\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"610\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/06\/test-before-commit1.png\" alt=\"\" class=\"wp-image-155890\"\/><\/figure>\n\n\n\n<p>We\u2019ve also improved the <em>Local History<\/em> menu, which helps you track all changes independently of version control. We\u2019ve added a new search field here to quickly find necessary text in your <em>Local History<\/em> revisions. To try it, right-click on the file and go to <em>Local History | Show History<\/em>.\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"602\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/06\/local-history-revision1.gif\" alt=\"\" class=\"wp-image-155901\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">New terminal options&nbsp;<\/h2>\n\n\n\n<p>Some of you probably have always wanted to use the <em>underline <\/em>or <em>vertical<\/em> cursor shape in our built-in terminal \u2013 we made it happen! To change it, go to <em>Preferences\/Settings | Tools | Terminal<\/em>.<\/p>\n\n\n\n<p>There is also one new option in the <em>Terminal <\/em>settings: we now support <em>Use Option as Meta key<\/em>.&nbsp;<\/p>\n\n\n\n<p>This may sound familiar \u2013 macOS native terminal has this option. The Meta key temporarily modifies the normal action of another key when they are pressed together. For instance, you can now use the following shortcuts when working in the terminal:&nbsp;<\/p>\n\n\n\n<ul><li><em>Option + F<\/em> \u2013 go to the next word<\/li><li><em>Option + B<\/em> \u2013 go back a word<\/li><li><em>Option + D<\/em> \u2013 delete the next word&nbsp;<\/li><\/ul>\n\n\n\n<p>Using the Meta key can improve your productivity if you use the terminal a lot. \u00a0 \u00a0 <em>\u00a0<\/em>\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/06\/new-terminal-options1.png\" alt=\"\" class=\"wp-image-155912\"\/><\/figure>\n\n\n\n<p>That\u2019s it for today. Please tell us what you think about these new features. Leave a comment here, ping us on <a href=\"https:\/\/twitter.com\/GoLandIDE\" target=\"_blank\" rel=\"noopener\">Twitter<\/a>, open an issue in <a href=\"https:\/\/youtrack.jetbrains.com\/issues\/GO?_gl=1*1ryja4i*_ga*MTMzMTM3NzQ1MS4xNjIxOTM2MTky*_ga_0WQ2ZF5VGT*MTYyMjQ3MTM1Ny4zOS4xLjE2MjI0NzE0NDkuMA..&amp;_ga=2.61428393.463726163.1622398163-1331377451.1621936192&amp;_gac=1.49805012.1621529532.Cj0KCQjwkZiFBhD9ARIsAGxFX8CLxXvfJzlAlF42EN3ry-0foEM5GdeLKEOzRSUXC2Dj1LK8EQNhW5UaAoKBEALw_wcB\" target=\"_blank\" rel=\"noopener\">our tracker<\/a>, or drop us a message in the <a href=\"https:\/\/invite.slack.golangbridge.org\/\" target=\"_blank\" rel=\"noopener\">Gophers Slack<\/a> #goland channel. Thanks!<\/p>\n","protected":false},"author":1254,"featured_media":150564,"comment_status":"closed","ping_status":"closed","template":"","categories":[826,4221],"tags":[6569,600,91],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/go\/150561"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/go"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/types\/go"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/users\/1254"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=150561"}],"version-history":[{"count":10,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/go\/150561\/revisions"}],"predecessor-version":[{"id":248785,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/go\/150561\/revisions\/248785"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media\/150564"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=150561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=150561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=150561"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/cross-post-tag?post=150561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}