binary_path=./bin
binary_file=test
GOPROXY=https://goproxy.cn,direct
GONOPROXY=*git.intra.w.com*
GOINSECURE=git.intra.w.com
GOPRIVATE=git.intra.w.com
default:build
build:
@git config --global url."ssh://git@git.intra.w.com:11".insteadOf "http://git.intra.w.com"
@GOPROXY=$(GOPROXY) GONOPROXY=$(GONOPROXY) GOINSECURE=$(GOINSECURE) go build -o ${binary_path}/${binary_file}
# clean the binary file @GOPROXY=$(GOPROXY) GONOPROXY=$(GONOPROXY) GOINSECURE=$(GOINSECURE) go build -o ${binary_path}/${binary_file}
clean:
@go clean
@if [ -f ${binary_path}/${binary_file} ]; then rm -f ${binary_path}/${binary_file}; fi
# show the version of the Go and the project
test:
@go version
.PHONY: default clean
其中下面的红色部分不可少
@GOPROXY=$(GOPROXY) GONOPROXY=$(GONOPROXY) GOINSECURE=$(GOINSECURE) go build -o ${binary_path}/${binary_file}