Skip to content

Commit 33f99c4

Browse files
committed
Vendor all dependencies
Uses godep to vendor dependencies. Godeps is not necessary during build, golang's new vendor support is used instead.
1 parent 041de0e commit 33f99c4

File tree

325 files changed

+127217
-40
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+127217
-40
lines changed

.travis.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@ sudo: false
22

33
language: go
44
go:
5-
- 1.5.2
6-
- tip
5+
- 1.5.3
6+
- tip
7+
8+
env:
9+
- GO15VENDOREXPERIMENT=1
710

811
install:
9-
- go get -d
10-
- go get golang.org/x/tools/cmd/vet
12+
- go get golang.org/x/tools/cmd/vet
1113

1214
script:
13-
- '! gofmt -l **/*.go | read nothing'
14-
- go vet
15-
- go test -v ./...
16-
- go build
17-
- ./end-to-end-test.sh
15+
- "! gofmt -l $(find . -path ./vendor -prune -o -name '*.go' -print) | read nothing"
16+
- go vet
17+
- go test -v $(go list ./... | grep -v /vendor/)
18+
- go build
19+
- ./end-to-end-test.sh

Makefile.COMMON

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,32 @@ GOOS ?= $(shell uname | tr A-Z a-z)
4545
GOARCH ?= $(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m)))
4646

4747
GO_VERSION ?= 1.5.3
48-
GOURL ?= https://golang.org/dl
49-
GOPKG ?= go$(GO_VERSION).$(GOOS)-$(GOARCH).tar.gz
50-
GOPATH := $(CURDIR)/.build/gopath
5148

5249
# Check for the correct version of go in the path. If we find it, use it.
5350
# Otherwise, prepare to build go locally.
5451
ifeq ($(shell command -v "go" >/dev/null && go version | sed -e 's/^[^0-9.]*\([0-9.]*\).*/\1/'), $(GO_VERSION))
5552
GOCC ?= $(shell command -v "go")
5653
GOFMT ?= $(shell command -v "gofmt")
57-
GO ?= GOPATH=$(GOPATH) $(GOCC)
54+
GO ?= $(GOCC)
5855
else
56+
GOURL ?= https://golang.org/dl
57+
GOPKG ?= go$(GO_VERSION).$(GOOS)-$(GOARCH).tar.gz
5958
GOROOT ?= $(CURDIR)/.build/go$(GO_VERSION)
6059
GOCC ?= $(GOROOT)/bin/go
6160
GOFMT ?= $(GOROOT)/bin/gofmt
62-
GO ?= GOROOT=$(GOROOT) GOPATH=$(GOPATH) $(GOCC)
61+
GO ?= GOROOT=$(GOROOT) $(GOCC)
62+
endif
63+
64+
# Use vendored dependencies if available. Otherwise try to download them.
65+
ifneq (,$(wildcard vendor))
66+
DEPENDENCIES := $(shell find vendor/ -type f -iname '*.go')
67+
GO := GO15VENDOREXPERIMENT=1 $(GO)
68+
else
69+
GOPATH := $(CURDIR)/.build/gopath
70+
ROOTPKG ?= github.com/prometheus/$(TARGET)
71+
SELFLINK ?= $(GOPATH)/src/$(ROOTPKG)
72+
DEPENDENCIES := dependencies-stamp
73+
GO := GOPATH=$(GOPATH) $(GO)
6374
endif
6475

6576
# Never honor GOBIN, should it be set at all.
@@ -68,32 +79,10 @@ unexport GOBIN
6879
SUFFIX ?= $(GOOS)-$(GOARCH)
6980
BINARY ?= $(TARGET)
7081
ARCHIVE ?= $(TARGET)-$(VERSION).$(SUFFIX).tar.gz
71-
ROOTPKG ?= github.com/prometheus/$(TARGET)
72-
SELFLINK ?= $(GOPATH)/src/$(ROOTPKG)
7382

7483
default: $(BINARY)
7584

76-
$(GOCC):
77-
@echo Go version $(GO_VERSION) required but not found in PATH.
78-
@echo About to download and install go$(GO_VERSION) to $(GOROOT)
79-
@echo Abort now if you want to manually install it system-wide instead.
80-
@echo
81-
@sleep 5
82-
mkdir -p .build
83-
# The archive contains a single directory called 'go/'.
84-
curl -L $(GOURL)/$(GOPKG) | tar -C .build -xzf -
85-
rm -rf $(GOROOT)
86-
mv .build/go $(GOROOT)
87-
88-
$(SELFLINK):
89-
mkdir -p $(dir $@)
90-
ln -s $(CURDIR) $@
91-
92-
dependencies-stamp: $(GOCC) $(SRC) | $(SELFLINK)
93-
$(GO) get -d
94-
touch $@
95-
96-
$(BINARY): $(GOCC) $(SRC) dependencies-stamp Makefile Makefile.COMMON
85+
$(BINARY): $(GOCC) $(SRC) $(DEPENDENCIES) Makefile Makefile.COMMON
9786
$(GO) build $(GOFLAGS) -o $@
9887

9988
.PHONY: archive
@@ -108,13 +97,36 @@ tag:
10897
git push --tags
10998

11099
.PHONY: test
111-
test: $(GOCC) dependencies-stamp
112-
$(GO) test ./...
100+
test: $(GOCC) $(DEPENDENCIES)
101+
$(GO) test $$($(GO) list ./... | grep -v /vendor/)
113102

114103
.PHONY: format
115104
format: $(GOCC)
116-
find . -iname '*.go' | egrep -v "^\./\.build|./generated|\./Godeps|\.(l|y)\.go" | xargs -n1 $(GOFMT) -w -s=true
105+
find . -iname '*.go' | egrep -v "^\./\.build|./generated|\./vendor|\.(l|y)\.go" | xargs -n1 $(GOFMT) -w -s=true
117106

118107
.PHONY: clean
119108
clean:
120109
rm -rf $(BINARY) $(ARCHIVE) .build *-stamp
110+
111+
112+
113+
$(GOCC):
114+
@echo Go version $(GO_VERSION) required but not found in PATH.
115+
@echo About to download and install go$(GO_VERSION) to $(GOROOT)
116+
@echo Abort now if you want to manually install it system-wide instead.
117+
@echo
118+
@sleep 5
119+
mkdir -p .build
120+
# The archive contains a single directory called 'go/'.
121+
curl -L $(GOURL)/$(GOPKG) | tar -C .build -xzf -
122+
rm -rf $(GOROOT)
123+
mv .build/go $(GOROOT)
124+
125+
$(SELFLINK):
126+
mkdir -p $(dir $@)
127+
ln -s $(CURDIR) $@
128+
129+
# Download dependencies if project doesn't vendor them.
130+
dependencies-stamp: $(GOCC) $(SRC) | $(SELFLINK)
131+
$(GO) get -d
132+
touch $@

vendor/github.com/Sirupsen/logrus/CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Sirupsen/logrus/LICENSE

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)