Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vendoring with govendor #2461

Merged
merged 1 commit into from Sep 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI

"Get downloads the packages named by the import paths, along with their
dependencies. It then installs the named packages, like 'go install'." - go get -h

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which is to say the go install line is superfluous.

It still appears here atm: https://github.com/spf13/hugo/blob/master/Makefile#L37

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I was looking at this on my phone and misunderstood where your comment was in the Makefile. The go install does indeed need to be removed.

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