当前位置:网站首页>[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

边栏推荐
- JSON string conversion in unity
- What are the virtual machine software? What are their respective functions?
- 【.NET+MQTT】.NET6 環境下實現MQTT通信,以及服務端、客戶端的雙邊消息訂閱與發布的代碼演示
- Illustrated network: what is the hot backup router protocol HSRP?
- Summary of Chinese remainder theorem
- What is the difference between enterprise wechat applet and wechat applet
- How to dynamically cache components in Vue multi-level route nesting
- Leecode 122. Zuijia timing of buying and selling stocks ②
- Graduation summary
- ctf-pikachu-CSRF
猜你喜欢

Constantly changing harmonyos custom JS components during the Spring Festival - Smart Koi

Jenkins configures IP address access

Is it really so difficult to learn redis? Today, a fan will share his personal learning materials!

Package details_ Four access control characters_ Two details of protected
![[untitled]](/img/b5/bf76783aa428222623d760756a14d9.jpg)
[untitled]

JVM family -- heap analysis

1289_FreeRTOS中vTaskSuspend()接口实现分析

Penetration practice - sqlserver empowerment
![[latex] production of complex tables: excel2latex and detail adjustment](/img/39/0d448ddf006eda262de3ed75666354.jpg)
[latex] production of complex tables: excel2latex and detail adjustment

Defensive programming skills
随机推荐
Illustrated network: what is the hot backup router protocol HSRP?
微信公众号网页授权
[PaddleSeg 源码阅读] PaddleSeg Transform 的 Normalize操作
Nbear introduction and use diagram
Cache general management class + cache httpcontext Current. Cache and httpruntime Differences between caches
My opinion on how to effectively telecommute | community essay solicitation
[PaddleSeg 源码阅读] PaddleSeg 自定义数据类
EV6 helps the product matrix, and Kia is making efforts in the high-end market. The global sales target in 2022 is 3.15 million?
Database SQL statement summary, continuous update
[paddleseg source code reading] paddleseg calculation dice
1289_ Implementation analysis of vtask suspend() interface in FreeRTOS
New year's first race, submit bug reward more!
What are the virtual machine software? What are their respective functions?
Day05 錶格
How about the ratings of 2022 Spring Festival Gala in all provinces? Map analysis helps you show clearly!
pytest多进程/多线程执行测试用例
Apple submitted the new MAC model to the regulatory database before the spring conference
CesiumJS 2022^ 源码解读[0] - 文章目录与源码工程结构
CSP drawing
三菱M70宏变量读取三菱M80公共变量采集三菱CNC变量读取采集三菱CNC远程刀补三菱机床在线刀补三菱数控在线测量