More makefile cleanup

This commit is contained in:
Katrina Verey
2022-04-04 16:43:43 -04:00
parent 0fa010c7e7
commit 46875b6ac4
12 changed files with 74 additions and 103 deletions

View File

@@ -1,17 +1,15 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
.PHONY: generate license fix vet fmt test build tidy image
.PHONY: generate fix vet fmt test build tidy image
GOBIN = $(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN = $(shell go env GOPATH)/bin
endif
export KUSTOMIZE_ROOT ?= $(shell pwd | sed -E 's|(.*\/kustomize)/(.*)|\1|')
include $(KUSTOMIZE_ROOT)/Makefile-tools.mk
build:
(cd image && go build -v -o $(GOBIN)/config-function .)
all: generate license build fix vet fmt test lint tidy
all: generate build fix vet fmt test lint tidy
fix:
(cd image && go fix ./...)
@@ -19,20 +17,17 @@ fix:
fmt:
(cd image && go fmt ./...)
generate:
(which $(GOBIN)/mdtogo || go get sigs.k8s.io/kustomize/cmd/mdtogo)
(cd image && GOBIN=$(GOBIN) go generate ./...)
license:
(which $(GOBIN)/addlicense || go get github.com/google/addlicense)
$(GOBIN)/addlicense -y 2022 -c "The Kubernetes Authors." -f LICENSE_TEMPLATE .
generate: $(MYGOBIN)/mdtogo
(cd image && GOBIN=$(MYGOBIN) go generate ./...)
tidy:
(cd image && go mod tidy)
lint:
(which $(GOBIN)/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1)
(cd image && $(GOBIN)/golangci-lint run ./...)
lint: $(MYGOBIN)/golangci-lint
(cd image && $(MYGOBIN)/golangci-lint \
-c $$KUSTOMIZE_ROOT/.golangci.yml \
--path-prefix $(shell pwd | sed -E 's|(.*\/kustomize)/(.*)|\2|') \
run ./...)
test:
(cd image && go test -cover ./...)