当前位置:网站首页>[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 04:31:00 【Yugong move code】
List of articles
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 main
import "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.6
gvm 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

边栏推荐
- 西部数据绿盘、蓝盘、黑盘、红盘和紫盘有什么区别
- Exploration and practice of eventbridge in the field of SaaS enterprise integration
- Unity资源路径
- 旭化成首次参展第五届中国国际进口博览会(5th CIIE)
- leetcode刷题:二叉树09(二叉树的最小深度)
- 普源DS1000Z系列数字示波器在通信原理实验中的应用方案
- RHCSA 08 - automount配置
- Leetcode skimming: binary tree 04 (sequence traversal of binary tree)
- Distributed cap theory
- The interactive solution of JS and app in the H5 page embedded in app (parameters can be transferred and callbacks can be made)
猜你喜欢

Leetcode skimming: binary tree 07 (maximum depth of binary tree)

深入解析结构化异常处理(SEH) - by Matt Pietrek

Distributed system: what, why, how

毕业设计项目

微信公众号无限回调授权系统源码

Wechat official account infinite callback authorization system source code

leetcode刷题:二叉树06(对称二叉树)

疫情远程办公经验分享| 社区征文

Redis: order collection Zset type data operation command

【愚公系列】2022年7月 Go教学课程 002-Go语言环境安装
随机推荐
A beautiful API document generation tool
新手找陪驾要注意什么
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
FT2000+下LPC中断绑核使用说明
Touch your hand and bring you a commonjs specification
tdk-lambda电源主要应用
I.MX6U-ALPHA开发板(C语言版本LED驱动实验)
【微服务|openfeign】@FeignClient详解
Redis:集合Set类型数据的操作命令
Senior developers tell you, how to write excellent code?
博朗与Virgil Abloh于2021年为纪念博朗品牌100周年而联合打造的“功能性艺术”将在博物馆展出Abloh作品期间首次亮相
多位科技公司创始人向Entrepreneur First提供高达1.58亿美元的C轮融资,协助其投资下一代全球创新者
leetcode刷题:二叉树06(对称二叉树)
GUI 应用:socket 网络聊天室
2020 Bioinformatics | TransformerCPI
Leetcode 121 best time to buy and sell stock (simple)
一位毕业生的自我分享
微信脑力比拼答题小程序_支持流量主带最新题库文件
架构实战营 - 第 6 期 模块九之毕业设计
(指針)自己寫一個比較字符串大小的函數,功能與strcmp類似。