export GOPATH=~/.go
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
===== Docker =====
docker build image template:
FROM golang:alpine AS build
WORKDIR /app
COPY app.go /app/
# disable CGO
ENV CGO_ENABLED=0
ENV GOOS=linux
RUN go build -ldflags '-w -extldflags "-static"' app.go
# ---
FROM scratch # or replace it to alpine
COPY --from=build /app/app /app
CMD ["/app"]