未验证 提交 936f704c 编写于 作者: M Mislav Marohnić 提交者: GitHub

Merge pull request #2142 from eli-schwartz/mod-vendor

build: pass mod vendoring flag on newer versions of go
......@@ -3,10 +3,15 @@ SOURCE_DATE_EPOCH ?= $(shell date +%s)
BUILD_DATE = $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" '+%d %b %Y' 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" '+%d %b %Y')
HUB_VERSION = $(shell bin/hub version | tail -1)
FLAGS_ALL = $(shell go version | grep -q 'go1.[89]' || echo 'all=')
export MOD_VENDOR_ARG := $(shell go version | grep -q 'go1.1[^0]' && echo '-mod=vendor')
export LDFLAGS := -extldflags '$(LDFLAGS)'
export GCFLAGS := $(FLAGS_ALL)-trimpath '$(PWD)'
export ASMFLAGS := $(FLAGS_ALL)-trimpath '$(PWD)'
ifneq ($(MOD_VENDOR_ARG),)
unexport GOPATH
endif
MIN_COVERAGE = 89.4
HELP_CMD = \
......@@ -46,7 +51,7 @@ bin/hub: $(SOURCES)
script/build -o $@
bin/md2roff: $(SOURCES)
go build -o $@ github.com/github/hub/md2roff-bin
go build $(MOD_VENDOR_ARG) -o $@ github.com/github/hub/md2roff-bin
test:
go test ./...
......
......@@ -14,6 +14,7 @@ find_source_files() {
build_hub() {
mkdir -p "$(dirname "$1")"
go build \
$MOD_VENDOR_ARG \
-ldflags "-X github.com/github/hub/version.Version=`./script/version` $LDFLAGS" \
-gcflags "$GCFLAGS" \
-asmflags "$ASMFLAGS" \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册