Past review:
- Go Language Tutorial – Introduction (1)
- Go Language Tutorial – Language Structure (2)
- Go Language Tutorial – Language Structure (3)
- Go Language Tutorial – Data Types (4)
- Go Language Tutorial – Language Variables (5)
- Go Language Tutorial – GO Language Constants (6)
- Go Language Tutorial – GO Language Operators (7)
- Go Language Tutorial – GO Conditions and Loop Statements (8)
- Go Language Tutorial – GO Language Functions (9)
- Go Language Tutorial – GO Language Variable Scope (10)
- Go Language Tutorial – GO Language Array (11)
- Go Language Tutorial – GO Language Pointer (12)
- Go Language Tutorial – GO Language Structure (13)
- Go Language Tutorial – GO Language Slice (Slice) (14)
- Go Language Tutorial – Go Language Range (Range) (15)
- Go Language Tutorial – Go Language Map (Collection) (16)
- Go Language Tutorial – Go Language Recursive Function (17)
- Go Language Tutorial – Go Language Type Conversion (18)
- Go Language Tutorial – Go Language Interface (19)
- Go Language Tutorial – Go Error Handling (20)
- Go Language Tutorial – Go Concurrency (21)
Article Directory
foreword
Goland is a cross-platform commercial IDE developed for Go by Czech software development company JetBrains. Goland has Strong Code Insight, Navigation & Search, Run & Debug, Integration with VCSs, More than just a Go IDE and strong Extensibility, which can help Gopher read and write Go code easily and quickly.
The IDE produced by JetBrains has a good reputation in the industry, such as Clion for C/C++, IntellijI IDEA for Java, PyCharm for Python, PhpStorm for PHP, WebStorm for JavaScript, etc. Once launched, Goland has been loved by many Gophers. It is recommended that you use it as the preferred IDE for Go.
The only regret is that Goland is a paid product. If you don't have the conditions or are bothered to crack it, the open source and free VSCode is also a good choice.
GoLand is a Go language IDE from the Jetbrains family, with a 30-day free trial period.
The installation is also very simple. Visit the download page of Goland, and download the corresponding software according to your current system environment on the three major platforms (Mac, Linux, Windows).
Get started quickly
The first step is to create a project.
File > New > Project
The second step is to configure GOROOT, which is the installation directory of Go. Here you need to install Go in advance.
File > Settings > Go > GOROOT
The third step is to configure GOPATH, which is the location where the Go source code, dependent packages and compiled executable files are stored. Multiple GOPATHs can be set.
File > Settings > Go > GOPATH
The src directory under GOPATH is the main directory of the next development program. All source code should be placed under this directory. Generally, our approach is to use one directory for one project.
The fourth step is to create the helloworld program. The Go project directory I created is as follows:
The fifth step is to compile and run helloworld.
右键 helloworld > Run > go build helloworld
The output is as follows:
common settings
- change theme
File > Settings > Editor > Color Scheme
- Change font type, size and line spacing
File > Settings > Editor > Font
- Change code file encoding method
File > Settings > Editor > File Encodings
- Modify Tab to specify the number of spaces, the default is 4 spaces
File > Settings > Editor > Code Style > Go
Commonly used shortcut keys
file related
CTRL + E: Open recently viewed files
CTRL + SHIFT + E: Open recently modified files
CTRL + SHIFT + N: Find files
find and locate
CTRL + R: replace text
CTRL + F: find text
CTRL + SHIFT + F: perform a global search
CTRL + G: quickly locate a line
CTRL + B: jump to the definition and reference of a method or structure
CTRL + left click: equivalent to CTRL + B
CTRL + ALT + Left/Right: go back or forward to the last cursor position
code editing
CTRL + ALT + T: Wrap the code in a code block, such as if{...} else{...}
CTRL + /: single-line comment
CTRL + SHIFT + /: multi-line comment
CTRL + +: collapse code block, structure or function CTRL + -: expand code block, structure or function
SHIFT
+ ENTER: insert a new line down
CTRL + Backspace: delete by word CTRL + D: copy the line where the current cursor is CTRL + X: cut ALT + SHIFT + UP/DOWN on the line where the cursor is
currently located : you can move the code in the line where the
cursor is located up and down CTRL + SHIFT + U: you can convert the selected content to upper and lower case
references
- [1] JetBrains official website
- [2] JetBrains Goland official website
- [3] GO language from entry to abandonment II: Goland installation and configuration