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}
本文介绍了如何使用Go语言进行项目构建,并详细说明了如何配置GOPROXY、GONOPROXY和GOINSECURE环境变量以确保安全性和高效下载依赖。同时,展示了如何创建和清理binary文件,以及查看Go版本和项目状态。

3648

被折叠的 条评论
为什么被折叠?



