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

fix: remove darwin shell hack in Makefile #810

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@

.PHONY: none
none:


.PHONY: deps
deps: go.mod go.sum
@echo "+ $@"
@go mod tidy
Expand All @@ -22,12 +18,6 @@ GOBIN := $(CURDIR)/.gobin
DIST := $(CURDIR)/dist
PATH := $(DIST):$(GOBIN):$(PATH)

# Makefile on Mac doesn't pass the updated PATH and GOBIN to the shell
# and so, without the following line, the shell does not end up
# trying commands in $(GOBIN) first.
# See https://stackoverflow.com/a/36226784/3690207
SHELL := env GOBIN=$(GOBIN) PATH=$(PATH) /bin/bash

KUBE_LINTER_BIN := $(GOBIN)/kube-linter

COVFILES := $(shell mktemp -d)
Expand All @@ -39,12 +29,12 @@ COVFILES := $(shell mktemp -d)
GOLANGCILINT_BIN := $(GOBIN)/golangci-lint
$(GOLANGCILINT_BIN): deps
@echo "+ $@"
go install github.com/golangci/golangci-lint/cmd/golangci-lint
GOBIN=$(GOBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint

GORELEASER_BIN := $(GOBIN)/goreleaser
$(GORELEASER_BIN): deps
@echo "+ $@"
go install github.com/goreleaser/goreleaser
GOBIN=$(GOBIN) go install github.com/goreleaser/goreleaser

###########
## Lint ##
Expand All @@ -56,9 +46,9 @@ ifdef CI
@echo '+ $@'
@echo 'The environment indicates we are in CI; running linters in check mode.'
@echo 'If this fails, run `make lint`.'
golangci-lint run
$(GOLANGCILINT_BIN) run
else
golangci-lint run --fix
$(GOLANGCILINT_BIN) run --fix
endif

.PHONY: lint
Expand Down Expand Up @@ -89,7 +79,8 @@ generated-srcs: go-generated-srcs generated-docs
build: $(KUBE_LINTER_BIN)

$(KUBE_LINTER_BIN): $(GORELEASER_BIN) $(shell find . -type f -name '*.go')
goreleaser build --snapshot --clean
$(GORELEASER_BIN) build --snapshot --clean
mkdir -p $(GOBIN)
@cp "$(DIST)/kube-linter_$(HOST_OS)_amd64_v1/kube-linter" "$(GOBIN)/kube-linter"
@chmod u+w "$(GOBIN)/kube-linter"

Expand Down
Loading