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

边栏推荐
- leetcode刷题:二叉树04(二叉树的层序遍历)
- Leader: who uses redis expired monitoring to close orders and get out of here!
- NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
- 浅谈一篇优质的小红书文案需要具备什么
- 浅谈JVM的那些事
- One click compilation and deployment of MySQL
- Apple CMS imitation watermelon video atmospheric response video template source code
- A beautiful API document generation tool
- ModStartBlog 现代化个人博客系统 v5.2.0 源码下载
- EventBridge 在 SaaS 企业集成领域的探索与实践
猜你喜欢

UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x98 in position 1093: illegal multibyte sequence

分布式CAP理论

I.MX6U-ALPHA开发板(C语言版本LED驱动实验)

96% of the collected traffic is prevented by bubble mart of cloud hosting

leetcode刷题:二叉树08(N叉树的最大深度)

Leetcode brush questions: binary tree 05 (flip binary tree)

虚拟商品帐号交易平台源码_支持个人二维码收款

Instructions for LPC interrupt binding under ft2000+

架构训练毕业设计+总结

十字路口通行优先权,十字路口通行规则图解
随机推荐
Flink learning 6: programming model
(pointeur) Écrivez - vous une fonction qui compare la taille de la chaîne et fonctionne comme strcmp.
分布式CAP理论
一位毕业生的自我分享
Keysight N9320B射频频谱分析仪解决轮胎压力监测方案
两万字带你掌握多线程
A beautiful API document generation tool
精品网址导航主题整站源码 wordpress模板 自适应手机端
How to telecommute more efficiently | community essay solicitation
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
Detailed explanation of event cycle
tdk-lambda电源主要应用
Virtual commodity account trading platform source code_ Support personal QR code collection
Statistical genetics: Chapter 3, population genetics
RHCSA 04 - 进程管理
I.MX6U-ALPHA开发板(C语言版本LED驱动实验)
软件测试是干什么的 发现缺陷错误,提高软件的质量
Rhcsa 01 - create partitions and file systems
leetcode刷题:二叉树04(二叉树的层序遍历)
PPt 教程,如何在 PowerPoint 中将演示文稿另存为 PDF 文件?