Skip to content

Commit d4b04a8

Browse files
committed
Makefile: use go trickery to fill GO_PKGS and GO_SRCS
This removes the dependency on `find` and avoids traversing a `vendor` directory if present.
1 parent 4e09c41 commit d4b04a8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ GOFMT := $(CURDIR)/script/gofmt
99
GOFLAGS := \
1010
--tags "static" \
1111
-ldflags "-X main.BuildVersion=$(shell git rev-parse HEAD) -X main.BuildDescribe=$(shell git describe --tags --always --dirty)"
12-
GO_PKGS := $(shell cd .gopath/src && find github.com/github/git-sizer/ -type f -name '*.go' | xargs -n1 dirname | grep -v '^github.com/github/git-sizer/vendor/' | sort -u)
13-
GO_SRCS := $(shell find . -type f -name '*.go' | grep -v '^\./vendor/' | sort -u)
12+
GO_PKGS := $(PACKAGE) \
13+
$(PACKAGE)/git-sizer \
14+
$(PACKAGE)/isatty \
15+
$(PACKAGE)/meter \
16+
$(PACKAGE)/sizes
17+
GO_SRCS := $(shell $(GO) list -f '{{$$ip := .ImportPath}}{{range .GoFiles}}{{printf ".gopath/src/%s/%s\n" $$ip .}}{{end}}{{range .CgoFiles}}{{printf ".gopath/src/%s/%s\n" $$ip .}}{{end}}{{range .TestGoFiles}}{{printf ".gopath/src/%s/%s\n" $$ip .}}{{end}}{{range .XTestGoFiles}}{{printf ".gopath/src/%s/%s\n" $$ip .}}{{end}}' $(GO_PKGS))
1418

1519
.PHONY: all
1620
all: bin/git-sizer

0 commit comments

Comments
 (0)