Hallo Habr!
Das erste große Update für GoLand 2021.1 wurde veröffentlicht. Wie üblich informieren wir Sie über die Neuerungen in der Version und zeigen Ihnen, wie Sie die neuen Funktionen verwenden.
Kurz gesagt, jetzt können Sie:
Erstellen und Ausführen von Programmen in einer Remote-Umgebung: Docker, SSH und WSL 2;
Go 1.16 (, //go:embed);
JSON;
;
-
, , !
, , JavaScript TypeScript, DataGrip WebStorm (, ). , GoLand – , IDE Go.
, . What's New in GoLand 2021.1 .
Run Targets
— Docker, SSH WSL2 IDE.
: Run | Edit Configurations. , Run on , .
, ( .). !
Go 1.16
//go:embed
Go 1.16: string (), []byte ( ), embed.FS .
GoLand , embed , Rename, Find usages ( ), . , GoLand , .
(t/b).Fatal
GoLand testing.T Fatal , .
t.Fatal ( ) , t.Error (return).
asn1.Unmarshal
Go 1.16 go vet asn1.Unmarshal , , ( ), nil.
GoLand 2021.1 .
JSON
JSON, GoLand 2021.1 . :)
JSON , Alt+Enter, Generate type from JSON. GoLand Generate Go type from the JSON JSON. , Generate . JSON .
, JSON . Generate struct fields from JSON, Alt+Enter Generate.
JSON- Generate Go type from JSON, GoLand .
JSON XML .
Alt+Enter Add key to tags , GoLand . , Alt+Enter Change field name style in tags. : fieldName, FieldName, field-name field_name.
Update key value in tags. Alt+Enter , GoLand .
, IDE JSON, XML ASN.1 .
GoLand JSON Lines, . . IDE .jsonl, .jslines, .ldjson .ndjson.
. JSON- . , .
Go “ , ”. , IDE , Unhandled Error . , , :
Handle error if error != nil.
Wrap error handling in a closure, defer go, , Handle error, (closure).
Ignore explicitly defer go. .
. .
Create Type
Create Type , , , .
set get
get set . , GoLand 2021.1 c .
Alt+Enter Generate getter and setters . GoLand Select Fields, get set - .
, Go, , :)
Extract Type
Extract Type . , Ctrl+Alt+Shift+T Windows Ctrl+T macOS.
Rename (go.mod)
, . , Rename go.mod . .
Rename Shift+F6 Windows/Linux ⇧F6 macOS. GoLand Rename, , , . Refactoring Preview . , .
varCheckError
.varCheckError , . IDE , if error != nil .
, goimports -local.
, Preferences/Settings | Editor | Code Style | Go | Imports . , .
Code With Me, , EAP GoLand , .
:
;
, .
, , GoLand.
, Code With Me .
GoLand 2021.1 sudo . GoLand , , . Preferences/Settings | Appearance & Behavior | System Settings | Process Elevation .
, , GoLand .
(ML). .
Mark position changes in the completion popup Preferences/Settings | Editor | General | Code Completion, , ML, / .
Configuration, IDE, . , , , IDE.
Windows ''
GoLand Windows, .
.
Preferences/Settings | Editor | Font.
HTML-
HTML-. , HTML-, CSS JavaScript-, , .
, GoLand .
? , , . , .
Makefile Language
Makefile Language GNU Make IDE. GoLand 2021.1 : , , Find Usages, .
, IntelliJ IDEA Ultimate, GoLand , .
!