Golang Notes
摘要:
Go 語言環境安裝
下載安裝包https://golang.google.cn/dl/
CentOS安裝為例:
1、下載原始碼包:go1.4.linux-amd64.tar.gz。
2、將下載的原始碼包解壓至 /usr/local目錄。
...
Go 語言環境安裝
- 下載安裝包ofollow,noindex">https://golang.google.cn/dl/
- CentOS安裝為例:
1、下載原始碼包:go1.4.linux-amd64.tar.gz。 2、將下載的原始碼包解壓至 /usr/local目錄。 tar -C /usr/local -xzf go1.4.linux-amd64.tar.gz 3、配置GOPATH、GOROOT環境變數: vi /etc/profile新增以下幾行在檔案末尾 export GOROOT=/usr/local/go export GOPATH=/home/www/go export PATH=$PATH:$GOROOT/bin 儲存退出 source /etc/profile立即生效
- 這個時候輸入以下命令就能看到安裝配置完成
[root@10-23-67-69 bin]# go version go version go1.11 linux/amd64 [root@10-23-67-69 bin]# go help Go is a tool for managing Go source code. Usage: go <command> [arguments] The commands are: bugstart a bug report buildcompile packages and dependencies cleanremove object files and cached files docshow documentation for package or symbol envprint Go environment information fixupdate packages to use new APIs fmtgofmt (reformat) package sources generategenerate Go files by processing source getdownload and install packages and dependencies installcompile and install packages and dependencies listlist packages or modules modmodule maintenance runcompile and run Go program testtest packages toolrun specified go tool versionprint Go version vetreport likely mistakes in packages Use "go help <command>" for more information about a command. Additional help topics: buildmodebuild modes ccalling between Go and C cachebuild and test caching environment environment variables filetypefile types go.modthe go.mod file gopathGOPATH environment variable gopath-getlegacy GOPATH go get goproxymodule proxy protocol importpathimport path syntax modulesmodules, module versions, and more module-getmodule-aware go get packagespackage lists and patterns testflagtesting flags testfunctesting functions