当前位置:网站首页>[Yugong series] go teaching course 002 go language environment installation in July 2022
[Yugong series] go teaching course 002 go language environment installation in July 2022
2022-07-04 03:57:00 【Hua Weiyun】
One 、Go Locale installation
Go Language is a compiling language, which needs SDK The toolkit compiles it to run , Second, you need an editing tool to write code , Finally SDK Tool configuration environment variables in , So the summary can include three aspects :
- SDK Kit installation
- VSCode install
- Environment variable configuration
Go Language supported systems include :Linux、FreeBSD、Mac OS X( Also known as Darwin)、Windows.
When will Go When the language source code is written, the computer cannot directly execute , You need to use a compiler to compile it into a binary executable , Then we need to use Go Linguistic SDK The kit .
Go Language SDK Installation package download address :https://golang.google.cn/dl/
Windows You can use .msi suffix ( The file can be found in the download list , Such as go1.18.3.windows-amd64.msi) Installation package to install .
By default .msi The files will be installed in c:\Go Under the table of contents . You can take c:\Go\bin Directory added to Path In the environment variables . After adding, you need to restart the command window to take effect .
Enter the following command to test whether the installation is successful
go version # Output version information go env # environmental information
Two 、 first Go Program
Go The flow chart of language operation is as follows :
1. Command line run
Script code test.go as follows :
package mainimport "fmt"func main() { fmt.Println("Hello, World!")}
Command line run :
go run test.go
Translate it into exe function
go build test.go ./test.exe
3、 ... and 、Go Language multi version control
occasionally , We will meet with Go Multiple versions of the language , To solve the need to install different versions in different scenarios , It can easily switch between different versions , Here's a recommendation gvm.
gvm yes Go Version Manager , Use shell Script development . You can install it according to the file , Reference resources : https://github.com/moovweb/gvm .
After installation , We can install other go Version of the .
gvm install go1.17.6gvm use go1.17.6
After executing the above command, you can add a new version Go ,GOPATH、GOROOT And other environment variables will be automatically set , Then you can directly use the specified version Go The language .
summary
边栏推荐
- 投资深度思考
- [paddleseg source code reading] paddleseg calculates Miou
- MySQL is dirty
- Mitsubishi M70 macro variable reading Mitsubishi M80 public variable acquisition Mitsubishi CNC variable reading acquisition Mitsubishi CNC remote tool compensation Mitsubishi machine tool online tool
- Mindmanager2022 efficient and easy to use office mind map MindManager
- Defensive programming skills
- Which product is better if you want to go abroad to insure Xinguan?
- Pandora IOT development board learning (HAL Library) - Experiment 6 independent watchdog experiment (learning notes)
- 智慧地铁| 云计算为城市地铁交通注入智慧
- How much does it cost to open a futures account in China? Where is it safe to open an account at present?
猜你喜欢
Constantly changing harmonyos custom JS components during the Spring Festival - Smart Koi
What are the virtual machine software? What are their respective functions?
postgresql 用户不能自己创建表格配置
2022-07-03:数组里有0和1,一定要翻转一个区间,翻转:0变1,1变0。 请问翻转后可以使得1的个数最多是多少? 来自小红书。3.13笔试。
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
Exercices de renforcement des déclarations SQL (MySQL 8.0 par exemple)
Tcpclientdemo for TCP protocol interaction
1289_FreeRTOS中vTaskSuspend()接口实现分析
Typical applications of minimum spanning tree
Audio and video technology development weekly | 232
随机推荐
system information
CesiumJS 2022^ 源码解读[0] - 文章目录与源码工程结构
Detailed explanation of PPTC self recovery fuse
New year's first race, submit bug reward more!
毕业总结
Mindmanager2022 efficient and easy to use office mind map MindManager
ctf-pikachu-CSRF
Monitoring - Prometheus introduction
Es network layer
支持首次触发的 Go Ticker
CesiumJS 2022^ 源码解读[0] - 文章目录与源码工程结构
Pandora IOT development board learning (HAL Library) - Experiment 6 independent watchdog experiment (learning notes)
Recursive structure
postgresql 用户不能自己创建表格配置
What is the difference between enterprise wechat applet and wechat applet
2022-07-03:数组里有0和1,一定要翻转一个区间,翻转:0变1,1变0。 请问翻转后可以使得1的个数最多是多少? 来自小红书。3.13笔试。
Leecode 122. Zuijia timing of buying and selling stocks ②
My opinion on how to effectively telecommute | community essay solicitation
Webhook triggers Jenkins for sonar detection
JSON string conversion in unity