Skip to content

Commit

Permalink
Add vendoring with govendor
Browse files Browse the repository at this point in the history
  • Loading branch information
moorereason authored and bep committed Sep 18, 2016
1 parent b3a7215 commit 6e692f2
Show file tree
Hide file tree
Showing 4 changed files with 435 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -10,3 +10,4 @@ cover.out
*.swo
.DS_Store
*~
vendor/*/
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -11,6 +11,8 @@ matrix:
allow_failures:
- go: tip
fast_finish: true
install:
- make govendor
script:
- make check
- go build -race
Expand Down
26 changes: 15 additions & 11 deletions Makefile
Expand Up @@ -8,8 +8,6 @@ COMMIT_HASH=`git rev-parse --short HEAD 2>/dev/null`
BUILD_DATE=`date +%FT%T%z`
LDFLAGS=-ldflags "-X github.com/spf13/hugo/hugolib.CommitHash=${COMMIT_HASH} -X github.com/spf13/hugo/hugolib.BuildDate=${BUILD_DATE}"

DIRS=$(shell go list -f {{.Dir}} ./...)

all: gitinfo

install: install-gitinfo
Expand All @@ -34,39 +32,45 @@ docker:
docker cp hugo-build:/go/bin/hugo .
docker rm hugo-build

govendor:
go get -u github.com/kardianos/govendor
go install github.com/kardianos/govendor
govendor get github.com/spf13/hugo

check: get fmt vet test test-race
check: fmt vet test test-race

cyclo:
@for d in $(DIRS) ; do \
@for d in `govendor list -no-status +local | sed 's/github.com.spf13.hugo/./'` ; do \
if [ "`gocyclo -over 20 $$d | tee /dev/stderr`" ]; then \
echo "^ cyclomatic complexity exceeds 20, refactor the code!" && echo && exit 1; \
fi \
done

fmt:
@for d in $(DIRS) ; do \
@for d in `govendor list -no-status +local | sed 's/github.com.spf13.hugo/./'` ; do \
if [ "`gofmt -l $$d/*.go | tee /dev/stderr`" ]; then \
echo "^ improperly formatted go files" && echo && exit 1; \
fi \
done

lint:
@if [ "`golint ./... | tee /dev/stderr`" ]; then \
echo "^ golint errors!" && echo && exit 1; \
fi
@for d in `govendor list -no-status +local | sed 's/github.com.spf13.hugo/./'` ; do \
if [ "`golint $$d | tee /dev/stderr`" ]; then \
echo "^ golint errors!" && echo && exit 1; \
fi \
done

get:
go get -v -t ./...

test:
go test ./...
govendor test +local

test-race:
go test -race ./...
govendor test -race +local

vet:
@if [ "`go vet ./... | tee /dev/stderr`" ]; then \
@if [ "`govendor vet +local | tee /dev/stderr`" ]; then \
echo "^ go vet errors!" && echo && exit 1; \
fi

0 comments on commit 6e692f2

Please sign in to comment.