当前位置:网站首页>[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.exe3、 ... 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.6After 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

边栏推荐
- Value transfer communication between components (parent to child, child to parent, brother component to value)
- JVM family -- monitoring tools
- The property of judging odd or even numbers about XOR.
- Object oriented -- encapsulation, inheritance, polymorphism
- 毕业总结
- Sales management system of lightweight enterprises based on PHP
- MySQL maxscale realizes read-write separation
- Apple submitted the new MAC model to the regulatory database before the spring conference
- [source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
- Easy to win insert sort
猜你喜欢
![[paddleseg source code reading] paddleseg custom data class](/img/88/37c535b371486db545abc392a685af.png)
[paddleseg source code reading] paddleseg custom data class

Webhook triggers Jenkins for sonar detection

Unity移动端游戏性能优化简谱之 画面表现与GPU压力的权衡

Jenkins configures IP address access

Penetration practice - sqlserver empowerment

Webhook triggers Jenkins for sonar detection

Typical applications of minimum spanning tree

SQL statement strengthening exercise (MySQL 8.0 as an example)

Objective-C description method and type method

Is it really so difficult to learn redis? Today, a fan will share his personal learning materials!
随机推荐
Easy to win insert sort
Aperçu du code source futur - série juc
Add IDM to Google browser
Select sorting and bubble sorting template
Pytest multi process / multi thread execution test case
渗透实战-guest账户-mimikatz-向日葵-sql提权-离线解密
[paddleseg source code reading] paddleseg calculation dice
Value transfer communication between components (parent to child, child to parent, brother component to value)
Teach you how to optimize SQL
New year's first race, submit bug reward more!
MySQL backup notes
What is the difference between enterprise wechat applet and wechat applet
[PaddleSeg 源码阅读] PaddleSeg 自定义数据类
System integration meets the three business needs of enterprises
A review of reverse reinforcement learning at Virginia Tech (VT)
Katalon framework tests web (XXI) to obtain element attribute assertions
Eh, the log time of MySQL server is less than 8h?
What kind of experience is it when the Institute earns 20000 yuan a month!
Unity移动端游戏性能优化简谱之 画面表现与GPU压力的权衡
what does ctrl + d do?