Cendos golang Env
#go env
?go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/golang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build807826116=/tmp/go-build -gno-record-gcc-switches"
# modity? /etc/profile
append /etc/profile
#GoRoot
export GOROOT=/usr/lib/golang
#gopath
export GOPATH=/root/go
#gopath bin
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
#source /etc/profile
#go version
go version go1.13.15 linux/amd64
#test go env
vi hello.go
write body to hello.go
#
package main
import "fmt"
func main(){
? ?fmt.Println("Hello World by \"hi dachan\"!")
}
# go build hello.go
#./hello
Hello World by "hi dachan"!
#go run hello.go
Hello World by "hi dachan"!