当前位置:网站首页>[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
边栏推荐
- MySQL data query optimization -- data structure of index
- Why is it recommended that technologists write blogs?
- Webhook triggers Jenkins for sonar detection
- Pandora IOT development board learning (HAL Library) - Experiment 6 independent watchdog experiment (learning notes)
- My opinion on how to effectively telecommute | community essay solicitation
- 支持首次触发的 Go Ticker
- 深入浅出对话系统——使用Transformer进行文本分类
- 【.NET+MQTT】.NET6 環境下實現MQTT通信,以及服務端、客戶端的雙邊消息訂閱與發布的代碼演示
- Future源碼一觀-JUC系列
- Objective-C description method and type method
猜你喜欢
Detailed explanation of PPTC self recovery fuse
Package details_ Four access control characters_ Two details of protected
Teach you how to optimize SQL
What is the difference between enterprise wechat applet and wechat applet
拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
Session learning diary 1
2022-07-03:数组里有0和1,一定要翻转一个区间,翻转:0变1,1变0。 请问翻转后可以使得1的个数最多是多少? 来自小红书。3.13笔试。
1289_FreeRTOS中vTaskSuspend()接口实现分析
@Scheduled scheduled tasks
If you have just joined a new company, don't be fired because of your mistakes
随机推荐
MySQL maxscale realizes read-write separation
数据库SQL语句汇总,持续更新......
Summary of Chinese remainder theorem
In my spare time, I like to write some technical blogs and read some useless books. If you want to read more of my original articles, you can follow my personal wechat official account up technology c
Simple dialogue system -- text classification using transformer
Select sorting and bubble sorting template
The new data center helps speed up the construction of a digital economy with data as a key element
Calculate the odd sum of 1~n (1~100 as an example)
Exercices de renforcement des déclarations SQL (MySQL 8.0 par exemple)
vue多级路由嵌套怎么动态缓存组件
Introduction to asynchronous task capability of function calculation - task trigger de duplication
pytest多进程/多线程执行测试用例
MySQL data query optimization -- data structure of index
logistic regression
渗透实战-guest账户-mimikatz-向日葵-sql提权-离线解密
Monitoring - Prometheus introduction
"Implement both software and hardware" to help build a new cloud computing data center
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?
Formulaire day05
pytest多进程/多线程执行测试用例