Skip to content

Commit

Permalink
Merge pull request #139 from rst0git/make-drop-check-go-version
Browse files Browse the repository at this point in the history
make: drop check-go-version target
  • Loading branch information
adrianreber authored Jul 19, 2024
2 parents f22f30b + 6ab2edf commit ee4e4e3
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,13 @@ include Makefile.versions

COVERAGE_PATH ?= $(shell pwd)/.coverage

GO_MAJOR_VER = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
GO_MINOR_VER = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
MIN_GO_MAJOR_VER = 1
MIN_GO_MINOR_VER = 20
GO_VALIDATION_ERR = Go version is not supported. Please update to at least $(MIN_GO_MAJOR_VER).$(MIN_GO_MINOR_VER)

.PHONY: all
all: $(NAME)

.PHONY: check-go-version
check-go-version:
@if [ $(GO_MAJOR_VER) -gt $(MIN_GO_MAJOR_VER) ]; then \
exit 0 ;\
elif [ $(GO_MAJOR_VER) -lt $(MIN_GO_MAJOR_VER) ]; then \
echo '$(GO_VALIDATION_ERR)';\
exit 1; \
elif [ $(GO_MINOR_VER) -lt $(MIN_GO_MINOR_VER) ] ; then \
echo '$(GO_VALIDATION_ERR)';\
exit 1; \
fi


$(NAME): $(GO_SRC)
$(GO_BUILD) -o $@ -ldflags "-X main.name=$(NAME) -X main.version=${VERSION}"

$(NAME).coverage: check-go-version $(GO_SRC)
$(NAME).coverage: $(GO_SRC)
$(GO) build \
-cover \
-o $@ \
Expand Down Expand Up @@ -91,7 +72,7 @@ test-junit: $(NAME)
make -C test test-junit clean

.PHONY: coverage
coverage: check-go-version $(NAME).coverage
coverage: $(NAME).coverage
mkdir -p $(COVERAGE_PATH)
COVERAGE_PATH=$(COVERAGE_PATH) COVERAGE=1 make -C test
# Print coverage from this run
Expand Down

0 comments on commit ee4e4e3

Please sign in to comment.