当前位置:网站首页>[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
边栏推荐
猜你喜欢
Virtual commodity account trading platform source code_ Support personal QR code collection
Leetcode skimming: binary tree 08 (maximum depth of n-ary tree)
Imitation of "game bird" source code, mobile game issue evaluation, open service, open test collection, game download website template
How to view installed r packages in R language
Distributed cap theory
Experience sharing of epidemic telecommuting | community essay solicitation
旭化成首次参展第五届中国国际进口博览会(5th CIIE)
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
TCP-三次握手和四次挥手简单理解
Statistical genetics: Chapter 3, population genetics
随机推荐
Instructions for LPC interrupt binding under ft2000+
ModStartBlog 现代化个人博客系统 v5.2.0 源码下载
leetcode刷题:二叉树04(二叉树的层序遍历)
资深开发人员告诉你,怎样编写出优秀的代码?
RPC技术
[security attack and Defense] how much do you know about serialization and deserialization?
tdk-lambda电源主要应用
Talking about what a high-quality little red book copy needs to have
(pointeur) Écrivez - vous une fonction qui compare la taille de la chaîne et fonctionne comme strcmp.
R语言中如何查看已安装的R包
Distributed cap theory
Tcp- simple understanding of three handshakes and four waves
旭化成首次参展第五届中国国际进口博览会(5th CIIE)
Boutique website navigation theme whole station source code WordPress template adaptive mobile terminal
一个漂亮的API文档生成工具
戳气球和布尔运算问题(巨难)
2020 Bioinformatics | TransformerCPI
苹果CMS仿西瓜视频大气响应式视频模板源码
MIN_RTO 对话
【微服务|openfeign】@FeignClient详解