一、安装Gin框架
1.查看配置环境
#go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/export/test-go"
GORACE=""
GOROOT="/export/go"
GOTOOLDIR="/export/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
注意:所有下载的包都会默认放在GOPATH,因此这个目录是必须的,且一般包含src pkg bin三个目录,分别存放源码包,编译包以及可执行文件
2.下载安装gopkg.in/yaml.v2包和gopkg.in/go-playground/validator.v8包
https://gopkg.in/yaml.v2.git
https://gopkg.in/go-playground/validator.v8.git
https://github.com/go-yaml/yaml.git
https://github.com/go-playground/validator.git
sudo mkdir -p $GOPATH/src/golang.org/x/
cd $GOPATH/src/golang.org/x/
git clone https://github.com/go-playground/validator.git validator
go install net
有疑问加站长微信联系(非本文作者)