命令
go install ./xxx/...
eg : go install ./gateway/...
docker 编译
1 拉取镜像
docker pull golang
2. 镜像设置
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go install
Docker file
# 启动编译环境
FROM golang:1.16
# 配置编译环境
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
# 拷贝源码到进行中
# COPY source image_path
COPY . /go/src/car/server
# 编译
WORKDIR /go/src/car/server
RUN go install ./gateway/...