Skip to content

Commit

Permalink
fix: remove darwin shell hack in Makefile
Browse files Browse the repository at this point in the history
Co-authored-by: Raad Haddad <[email protected]>
Signed-off-by: Tomasz Janiszewski <[email protected]>
  • Loading branch information
janisz and raadfhaddad committed Jul 12, 2024
1 parent 2d94898 commit abe3384
Showing 1 changed file with 7 additions and 16 deletions.
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

0 comments on commit abe3384

Please sign in to comment.