内容简介:国内资源Go语言中文网https://studygolang.com/dl一、下载安装包二、解压安装
国内资源 Go 语言中文网https://studygolang.com/dl
一、下载安装包
wget https://studygolang.com/dl/golang/go1.11.linux-amd64.tar.gz
二、解压安装
注:go安装包是已经编译,直接将解压后的包放置在/usr/local/下
tar zxvf go1.11.linux-amd64.tar.gz -C /usr/local
三、配置go环境变量
vim /etc/profile
export GOROOT=/usr/local/go
export GOPATH=/home/go_code
export GOBIN=/usr/local/go/bin
export PATH=$PATH:$GOROOT
source /etc/profile
四、检测go版本
go version
go version go1.11 linux/amd64
五、检测go环境
go env
GOARCH="amd64"
GOBIN="/usr/local/go/bin"
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/go_code"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build843021042=/tmp/go-build -gno-record-gcc-switches"
六、配置go项目目录结构
go code目录:/home/go_code
源码存放路径:/home/go_code/src
二进制文件存放路径:/home/go_code/bin
依赖包存放路径:/home/go_code/pkg
七、测试程序
cat test.go
package main
import (
"fmt"
)
func main() {
fmt.Printf("hello world")
}
go run test.go
hello world
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Ordering Disorder
Khoi Vinh / New Riders Press / 2010-12-03 / USD 29.99
The grid has long been an invaluable tool for creating order out of chaos for designers of all kinds—from city planners to architects to typesetters and graphic artists. In recent years, web designers......一起来看看 《Ordering Disorder》 这本书的介绍吧!