refactor: hash is a much faster shell-builtin alternative to which. (#192)

This commit is contained in:
Bo-Yi Wu 2017-02-27 21:45:00 +08:00 committed by GitHub
parent 969c0edf29
commit 92b9da2f00
1 changed files with 4 additions and 4 deletions

View File

@ -51,19 +51,19 @@ embedmd:
embedmd -d *.md embedmd -d *.md
errcheck: errcheck:
@which errcheck > /dev/null; if [ $$? -ne 0 ]; then \ @hash errcheck > /hashnull 2>&1; if [ $$? -ne 0 ]; then \
go get -u github.com/kisielk/errcheck; \ go get -u github.com/kisielk/errcheck; \
fi fi
errcheck $(PACKAGES) errcheck $(PACKAGES)
lint: lint:
@which golint > /dev/null; if [ $$? -ne 0 ]; then \ @hash golint > /hashnull 2>&1; if [ $$? -ne 0 ]; then \
go get -u github.com/golang/lint/golint; \ go get -u github.com/golang/lint/golint; \
fi fi
for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done; for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
unconvert: unconvert:
@which unconvert > /dev/null; if [ $$? -ne 0 ]; then \ @hash unconvert > /hashnull 2>&1; if [ $$? -ne 0 ]; then \
go get -u github.com/mdempsky/unconvert; \ go get -u github.com/mdempsky/unconvert; \
fi fi
for PKG in $(PACKAGES); do unconvert -v $$PKG || exit 1; done; for PKG in $(PACKAGES); do unconvert -v $$PKG || exit 1; done;
@ -106,7 +106,7 @@ release-dirs:
mkdir -p $(DIST)/binaries $(DIST)/release mkdir -p $(DIST)/binaries $(DIST)/release
release-build: release-build:
@which gox > /dev/null; if [ $$? -ne 0 ]; then \ @hash gox > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
go get -u github.com/mitchellh/gox; \ go get -u github.com/mitchellh/gox; \
fi fi
gox -os="$(TARGETS)" -arch="$(ARCHS)" -tags="$(TAGS)" -ldflags="$(EXTLDFLAGS)-s -w $(LDFLAGS)" -output="$(DIST)/binaries/$(EXECUTABLE)-$(VERSION)-{{.OS}}-{{.Arch}}" gox -os="$(TARGETS)" -arch="$(ARCHS)" -tags="$(TAGS)" -ldflags="$(EXTLDFLAGS)-s -w $(LDFLAGS)" -output="$(DIST)/binaries/$(EXECUTABLE)-$(VERSION)-{{.OS}}-{{.Arch}}"