kyaml: fixup Makefile

- Change name of generated binary to `config` to match module name
- Use GOBIN instead of GOPATH to simplify commands
- Export GOBIN environment variable to the `go generate` command so it can find built commands
This commit is contained in:
Phillip Wittrock
2019-11-22 11:49:39 -08:00
parent b240092058
commit f531ac065d
3 changed files with 22 additions and 8 deletions

View File

@@ -3,10 +3,10 @@
.PHONY: generate license fix vet fmt test build tidy
GOPATH := $(shell go env GOPATH)
GOBIN := $(shell go env GOPATH)/bin
build:
go build -v -o $(GOPATH)/bin/kyaml .
go build -v -o $(GOBIN)/config .
all: generate license fix vet fmt test lint tidy
@@ -17,18 +17,18 @@ fmt:
go fmt ./...
generate:
go generate ./...
GOBIN=$(GOBIN) go generate ./...
license:
(which $(GOPATH)/bin/addlicense || go get github.com/google/addlicense)
$(GOPATH)/bin/addlicense -y 2019 -c "The Kubernetes Authors." -f LICENSE_TEMPLATE .
(which $(GOBIN)/addlicense || go get github.com/google/addlicense)
$(GOBIN)/addlicense -y 2019 -c "The Kubernetes Authors." -f LICENSE_TEMPLATE .
tidy:
go mod tidy
lint:
(which $(GOPATH)/bin/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1)
$(GOPATH)/bin/golangci-lint run ./...
(which $(GOBIN)/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1)
$(GOBIN)/golangci-lint run ./...
test:
go test -cover ./...