go安装-window环境
#----------------------------------------------
一、安装地址:
/dl/
如果不能访问换为:
/dl/
/
二、下载window版本:go1.17.5.windows-amd64.msi (124MB)
Featured downloads:
go1.17.5.windows-amd64.msi (124MB)
#----------------------------------------------
Microsoft Windows
Windows 7 or later, Intel 64-bit processor
注意:千万不要在安装路径中出现中文。否则之后将无法正常使用Go语言开发工具
三、配置windows环境变量
GOBIN=E:\Go\bin
GOARCH=amd64
GOOS=windows
GOROOT=E:\Go
Path中添加%GOBIN%或E:\Go\bin
#----------------------------------------------
如果是32位的:
GOARCH=386
四、测试安装是否成功
打开cmd.exe执行命令:
go version
go help
显示如下所示表示正常安装成功
go version go1.17.5 windows/amd64
五、第一个go程序
e:
cd e:\go\hsg
#----------------
e:\go\hsg\test.go代码如下:
#-----------------------------------------------------
package main
import “fmt”
func main(){ //这个大括号必须在这里:代码规范
fmt.Printf(“Hello World!\n”);
}
#-----------------------------------------------------
编译cmd命令如下所示:
go build test.go
执行:test.exe
输出结果为:
#-----------------------------------------
E:\Go\hsg>test.exe
Hello World!
六、开发IDE(Goland,vs code)
Goland
#----------------------------------------
Goland 简介
Goland 是由 JetBrains 公司开发的一个新的商业 IDE,旨在为 Go 开发者提供的一个符合人体工程学的新的商业 IDE。Goland 整合了 IntelliJ 平台(一个用于 java 语言开发的集成环境,也可用于其他开发语言),提供了针对Go语言的编码辅助和工具集成。
下载goland地址:
/go/download/other.html
最新版为:goland-.3.2.exe
vs code
vs code 搜索go插件
go help
Go is a tool for managing Go source code.
Usage:
go <command> [arguments]
The commands are:
bug start a bug reportbuild compile packages and dependenciesclean remove object files and cached filesdoc show documentation for package or symbolenv print Go environment informationfix update packages to use new APIsfmt gofmt (reformat) package sourcesgenerate generate Go files by processing sourceget add dependencies to current module and install theminstallcompile and install packages and dependencieslist list packages or modulesmod module maintenancerun compile and run Go programtest test packagestool run specified go toolversionprint Go versionvet report likely mistakes in packages
Use "go help " for more information about a command.
Additional help topics:
buildconstraint build constraintsbuildmode build modesccalling between Go and Ccache build and test cachingenvironmentenvironment variablesfiletype file typesgo.modthe go.mod filegopathGOPATH environment variablegopath-getlegacy GOPATH go getgoproxy module proxy protocolimportpathimport path syntaxmodules modules, module versions, and moremodule-getmodule-aware go getmodule-authmodule authentication using go.sumpackages package lists and patternsprivate configuration for downloading non-public codetestflag testing flagstestfunc testing functionsvcs controlling version control with GOVCS
Use "go help " for more information about that topic.
—the—end—
如果觉得《go安装-window环境》对你有帮助,请点赞、收藏,并留下你的观点哦!