{"id":119019,"date":"2021-02-26T12:32:57","date_gmt":"2021-02-26T11:32:57","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=go&#038;p=119019"},"modified":"2021-06-07T09:53:45","modified_gmt":"2021-06-07T08:53:45","slug":"goland-2021-1-eap-5","status":"publish","type":"go","link":"https:\/\/blog.jetbrains.com\/zh-hans\/go\/2021\/02\/26\/goland-2021-1-eap-5","title":{"rendered":"GoLand 2021.1 EAP 5 has a New Postfix Completion, builtin goimports -local support, better Go 1.16 support and more"},"content":{"rendered":"<p>We have a new GoLand 2021.1 EAP release to share with you. It has a lot of exciting new features for you to try out, including:<\/p>\n<ul>\n<li><a href=\"https:\/\/blog.jetbrains.com\/go\/2021\/02\/25\/goland-2021-1-eap-5-has-a-new-postfix-completion-builtin-goimports-local-support-better-go-1-16-support-and-more\/#varCheckErr-postfix-completion\">A new &#8220;varCheckError&#8221; Postfix Completion.<\/a><\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/go\/2021\/02\/25\/goland-2021-1-eap-5-has-a-new-postfix-completion-builtin-goimports-local-support-better-go-1-16-support-and-more\/#goimports-local-import-grouping\">Formatter support for grouping imports the way &#8220;goimports -local&#8221; does.<\/a><\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/go\/2021\/02\/25\/goland-2021-1-eap-5-has-a-new-postfix-completion-builtin-goimports-local-support-better-go-1-16-support-and-more\/#go1.16-support\">Go 1.16 support<\/a>\n<ul>\n<li><a href=\"https:\/\/blog.jetbrains.com\/go\/2021\/02\/25\/goland-2021-1-eap-5-has-a-new-postfix-completion-builtin-goimports-local-support-better-go-1-16-support-and-more\/#asn1-unmarshal-inspection\">New inspection for asn1.Unmarshal usage.<\/a><\/li>\n<li><a href=\"https:\/\/blog.jetbrains.com\/go\/2021\/02\/25\/goland-2021-1-eap-5-has-a-new-postfix-completion-builtin-goimports-local-support-better-go-1-16-support-and-more\/#fix-go1.16-gopath-support\">Fixed support for GOPATH based projects.<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>There are, of course, plenty of other fixes and improvements under the hood.<\/p>\n<p align=\"center\"><a class=\"jb-download-button\" href=\"https:\/\/www.jetbrains.com\/go\/nextversion\/\" target=\"_blank\" rel=\"noopener\"><i class=\"download-icon\"><\/i>Download GoLand 2021.1 EAP #5<\/a><\/p>\n<p>You can get the build via the <a href=\"https:\/\/www.jetbrains.com\/toolbox\/app\/\" target=\"_blank\" rel=\"noopener\">Toolbox App<\/a>, download it from our<a href=\"https:\/\/www.jetbrains.com\/go\/nextversion\/\" target=\"_blank\" rel=\"noopener\"> <\/a><a href=\"https:\/\/www.jetbrains.com\/go\/nextversion\/\" target=\"_blank\" rel=\"noopener\">website<\/a>, or use a snap package (for Ubuntu). Or from inside GoLand, select <em>Automatically check updates for Early Access Program<\/em> in <em>Settings\/Preferences  | Appearance &amp; Behavior | System Settings | Updates<\/em>.<\/p>\n<h2 id=\"varCheckErr-postfix-completion\">A new varCheckError Postfix Completion<\/h2>\n<p>Postfix Completions are a way to surround code with templates after you&#8217;ve finished typing it.<\/p>\n<p>GoLand already has several such templates, which can be found under <em>Settings\/Preferences | Editor | General | Postfix Completion | Go<\/em>.<\/p>\n<p>EAP version 5 adds one more to the list, <code>varCheckError<\/code>.<\/p>\n<p>How does it work? Type <code>.vCE<\/code> after an identifier that returns an error, and the IDE will automatically add default variable names and return the error from the function.<\/p>\n<p><img decoding=\"async\" class=\"wp-image-55173 size-full\" style=\"border: 1px solid #AAAAAA;\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/02\/varErrCheck-postfix-completion-optimized.png\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/02\/varErrCheck-postfix-completion-optimized.gif\" alt=\"varCheckError postfix completion\" width=\"750\"><\/p>\n<p><strong>Pro tip:<\/strong> Did you know that you can write your templates? <a href=\"https:\/\/www.jetbrains.com\/help\/go\/auto-completing-code.html#reference.custom.postfix.templates\" target=\"_blank\" rel=\"noopener\">Check out our documentation<\/a> to learn how.<\/p>\n<h2 id=\"goimports-local-import-grouping\">Support for &#8220;goimports -local&#8221; import grouping<\/h2>\n<p>The built-in formatter can now group imports in the same way <code>goimports -local<\/code> does.<\/p>\n<p>To enable this support, head over to <em>Settings\/Preferences | Editor | Code Style | Go | Imports<\/em> and enable import grouping. Then you can specify which imports should be grouped into separate blocks.<\/p>\n<p><img decoding=\"async\" class=\"wp-image-55173 size-full\" style=\"border: 1px solid #AAAAAA;\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/02\/goimports-local-import-grouping.png\" alt=\"Configure goimports -local support in the IDE\" width=\"750\"><\/p>\n<h2 id=\"go1.16-support\">Go 1.16 support<\/h2>\n<h3 id=\"asn1-unmarshal-inspection\">New inspection for asn1.Unmarshal usage<\/h3>\n<p>o 1.16 introduced a new <code>go vet<\/code> inspection for <code>asn1.Unmarshal<\/code>. It ensures that the value in which a slice of bytes is unmarshaled is not nil. We&#8217;ve implemented a similar check, and we&#8217;ve also added a quick-fix to resolve this problem.<\/p>\n<p><img decoding=\"async\" class=\"wp-image-55173 size-full\" style=\"border: 1px solid #AAAAAA;\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/02\/asn1Unmarshal-into-nil-.png\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/02\/asn1Unmarshal-into-nil.gif\" alt=\"Configure goimports -local support in the IDE\" width=\"750\"><\/p>\n<h3 id=\"fix-go1.16-gopath-support\">Fixed support for GOPATH-based project<\/h3>\n<p>With Go 1.16, we had to adjust our GOPATH-based project model to account for the new GO111MODULES variable being default everywhere.<\/p>\n<p>These adjustments should resolve any difficulties involving imports not being located by the IDE after running <code>go get<\/code> or running <code>go build<\/code> not working correctly.<\/p>\n<p>For more information about this problem, you can look at <a href=\"https:\/\/youtrack.jetbrains.com\/issue\/GO-10639\" target=\"_blank\" rel=\"noopener\">GO-10639<\/a> and <a href=\"https:\/\/youtrack.jetbrains.com\/issue\/GO-10643\" target=\"_blank\" rel=\"noopener\">GO-10643<\/a> on our tracker.<\/p>\n<p>That&#8217;s it for today.<\/p>\n<p>Check out our <a href=\"https:\/\/confluence.jetbrains.com\/display\/GOLAND\/GoLand%2B211.6222.2%2BRelease%2BNotes\" target=\"_blank\" rel=\"noopener\">release notes<\/a> to learn about even more issues that we&#8217;ve addressed in this build.<\/p>\n<p>As usual, your feedback is invaluable to us, and we&#8217;d like to hear your thoughts about these features and about what else we can do to make your experience even better. Don&#8217;t hesitate to contact us by writing in the comments section below, opening an issue on <a href=\"https:\/\/youtrack.jetbrains.com\/issues\/Go\" target=\"_blank\" rel=\"noopener\">our tracker<\/a>, dropping us a line in the Gophers Slack #goland channel, or pinging us <a href=\"https:\/\/twitter.com\/GoLandIDE\" target=\"_blank\" rel=\"noopener\">on Twitter<\/a> or other social media platforms.<\/p>\n","protected":false},"author":828,"featured_media":111888,"comment_status":"closed","ping_status":"closed","template":"","categories":[826,4221],"tags":[6412,6471,600,6472,756,91,2441],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/go\/119019"}],"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\/828"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=119019"}],"version-history":[{"count":10,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/go\/119019\/revisions"}],"predecessor-version":[{"id":151132,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/go\/119019\/revisions\/151132"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media\/111888"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=119019"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=119019"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=119019"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/cross-post-tag?post=119019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}