当前位置:网站首页>Environment construction of go language foundation
Environment construction of go language foundation
2022-06-23 22:06:00 【Ink purple feather ink】
One 、go Download and install of
1、 Download address :https://golang.google.cn/dl/
2、 install : When the download is complete ,Windows Double click the version to install ( Remember this installation address , You need to use... When configuring environment variables later )
3、 Check :win+R Input cmd Enter to open the terminal window , Input go If the following information is available, the installation is successful
4、 establish go Working space for (GOPATH The directory that the environment variable points to )
GO The code must be in the workspace . The workspace is a directory , It contains three subdirectories :
src---- Every subdirectory in it , It's just a bag . Inside the bag isGoSource filepkg---- Generated after compilation , The target file for the packagebin---- Generated executable file
Two 、GOPATH Set up
GOROOT:GoThe path to the root directory of the language installation , That is to sayGOLanguage installation path .GOPATH: Is an environment variable , Used to show what you wrotegoThe storage path of the project . It is better to set only one path , All project code is put inGOPATHOfsrcUnder the table of contentsGOBIN:GOExecutable files generated by the program (executable file) The path of .
We can GOPATH It is simply understood as Go Working directory of languages , Its value is the path to a directory , It can also be multiple directory paths , Each directory represents Go A workspace for languages (workspace). We need to benefit these workspaces , To place Go Language source file (source file), And installation (install) Archive after (archive file, That is to say “.a” File with extension ) And executables (executable file). in fact , because Go All operations of a language project in its life cycle ( code 、 Dependency management 、 structure 、 test 、 Installation, etc ) Basically around GOPATH And work area .
1、 Environment variable configuration :
- My computer -> attribute -> Advanced system setup -> environment variable
- newly added
GOPATHSet the value as you want to savegoCode directory
3、 To configure path: hold go Installation directory and gopath Directory configuration
4、 Check : stay cmd Enter... In the terminal box go env If any, as shown in the figure gopath It means that the setting is successful
3、 ... and 、vscode Download and install of
1、 Download address :https://code.visualstudio.com/
2、 install : When the download is complete , Double click Install directly , And then the next step 、 The next step is to
3、 To configure :
- Configure Chinese
- install
goplug-in unit
Four 、hello world Program
1、 Use vscode Open our new project directory , Write our first go Language program
2、 stay src Create a new one under the directory hello The catalog of , Then I'm building a new hello.go file
package main
import "fmt"
func main(){
fmt.Println("hello world")
}3、 Click View in the menu bar -> terminal , Input go run hello/hello.go
边栏推荐
- CAD图在线Web测量工具代码实现(测量距离、面积、角度等)
- Selenium batch query athletes' technical grades
- Ffmpeg for audio and video commands
- 什么是股票线上开户?手机开户安全么?
- How to batch generate video QR code
- Raid card with hardware knowledge (5)
- How to do API gateway routing? What are the other functions of API gateway?
- EDI mandatory manual
- 北大、加州伯克利大学等联合| Domain-Adaptive Text Classification with Structured Knowledge from Unlabeled Data(基于未标记数据的结构化知识的领域自适应文本分类)
- Tencent cloud database tdsql elite challenge Q & A (real-time update)
猜你喜欢

How to improve the content quality of short video, these four elements must be achieved

Code implementation of CAD drawing online web measurement tool (measuring distance, area, angle, etc.)

Bluetooth chip | Renesas and Ti launch new Bluetooth chip, try Lenz st17h65 Bluetooth ble5.2 chip

北大、加州伯克利大學等聯合| Domain-Adaptive Text Classification with Structured Knowledge from Unlabeled Data(基於未標記數據的結構化知識的領域自適應文本分類)

北大、加州伯克利大学等联合| Domain-Adaptive Text Classification with Structured Knowledge from Unlabeled Data(基于未标记数据的结构化知识的领域自适应文本分类)

蓝牙芯片|瑞萨和TI推出新蓝牙芯片,试试伦茨科技ST17H65蓝牙BLE5.2芯片

从CVPR 2022看域泛化(Domain Generalization)最新研究进展

Configuring error sets using MySQL for Ubuntu 20.04.4 LTS

Error running PyUIC: Cannot start process, the working directory ‘-m PyQt5. uic. pyuic register. ui -o

Code implementation of CAD drawing online web measurement tool (measuring distance, area, angle, etc.)
随机推荐
What do you know about the 15 entry-level applets
Cloud native practice of meituan cluster scheduling system
Practice of business level disaster recovery switching drill
HR SaaS is finally on the rise
Icml2022 | robust task representation for off-line meta reinforcement learning based on contrastive learning
Build DNS server in Intranet
What causes the applet SSL certificate to expire? How to solve the problem when the applet SSL certificate expires?
What is the reason for the error when calling API prompt 401 after easycvr replaces the version?
Cloud database smooth disassembly scheme
万字长文!一文搞懂InheritedWidget 局部刷新机制
One article to help you understand automatic injection
Relevant logic of transaction code MICn in SAP mm
How to set the life cycle of API gateway
从CVPR 2022看域泛化(Domain Generalization)最新研究进展
Introduction to scikit learn machine learning practice
How to use the serial port assistant in STC ISP?
Peking University, University of California Berkeley and others jointly | domain adaptive text classification with structured knowledge from unlabeled data (Domain Adaptive Text Classification Based o
Make it simple. This wave of global topology is quite acceptable!
How to write test cases efficiently?
v-chart