Go官网
|
|
下载地址
|
|
安装环境
|
|
假定你想要安装Go的目录为 $GO_INSTALL_DIR
|
|
GOROOT只有在自定义安装目录时,才需要设置。
执行命令
|
|
Go is a tool for managing Go source code.
Usage:
go command [arguments]
The commands are:
12345678910111213
build compile packages and dependenciesclean remove object filesenv print Go environment informationfix run go tool fix on packagesfmt run gofmt on package sourcesget download and install packages and dependenciesinstall compile and install packages and dependencieslist list packagesrun compile and run Go programtest test packagestool run specified go toolversion print Go versionvet run go tool vet on packagesUse “go help [command]” for more information about a command.
Additional help categories:
1234567
c calling between Go and Cfiletype file typesgopath GOPATH environment variableimportpath import path syntaxpackages description of package liststestflag description of testing flagstestfunc description of testing functionsUse “go help [topic]” for more information about that topic.
Windows下安装
安装环境
|
|
假定你想安装的目录为:C:\Go
环境变量
这里,我们将设置一下环境变量
右键点击计算机
-> 属性
-> 高级系统设置
->环境变量
用户变量
:针对当前用户有效。系统变量
:针对所有用户有效。
新建变量名:GOROOT
。变量值:C:\Go
。
新建变量名:GOPATH
。变量值:D:\goroot
。
编辑变量Path
:变量值最后加入:%GOROOT%\bin
。
运行
开启CMD命令行窗口。
安装成功!
运行Go程序
1、创建脚本:test.go
|
|
2、执行脚本
|
|
3、程序输出
|
|