@@ -72,15 +72,18 @@ help:
7272 @echo " GOPATH=$( GOPATH) "
7373 @echo " The following commands are available:"
7474 @echo " "
75- @echo " make clean : Remove any build artifact"
76- @echo " make coverage : Generate the coverage report"
77- @echo " make deps : Get dependencies"
78- @echo " make format : Format the source code"
79- @echo " make linter : Check code against multiple linters"
80- @echo " make mod : Download dependencies"
81- @echo " make modupdate : Update dependencies"
82- @echo " make qa : Run all tests and static analysis tools"
83- @echo " make test : Run unit tests"
75+ @echo " make clean : Remove any build artifact"
76+ @echo " make coverage : Generate the coverage report"
77+ @echo " make deps : Get dependencies"
78+ @echo " make format : Format the source code"
79+ @echo " make linter : Check code against multiple linters"
80+ @echo " make mod : Download dependencies"
81+ @echo " make qa : Run all tests and static analysis tools"
82+ @echo " make test : Run unit tests"
83+ @echo " make updateall : Update everything"
84+ @echo " make updatego : Update Go version"
85+ @echo " make updatelint : Update golangci-lint version"
86+ @echo " make updatemod : Update dependencies"
8487 @echo " "
8588 @echo " Use DEVMODE=LOCAL for human friendly output."
8689 @echo " "
@@ -146,12 +149,6 @@ linter:
146149mod :
147150 $(GO ) mod download all
148151
149- # Update dependencies
150- .PHONY : modupdate
151- modupdate :
152- # $(GO) get $(shell $(GO) list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)
153- $(GO ) get -t -u ./... && go mod tidy -compat=$(shell grep -oP 'go \K[0-9]+\.[0-9]+' ../go.mod)
154-
155152# Run all tests and static analysis tools
156153.PHONY : qa
157154qa : test coverage linter
@@ -170,3 +167,27 @@ test: ensuretarget
170167 -coverprofile=$(TARGETDIR ) /report/coverage.out \
171168 -v $(SRCDIR ) $(TESTEXTRACMD )
172169 @echo -e " \n\n>>> END: Unit Tests <<<\n\n"
170+
171+ # Update everything
172+ .PHONY : updateall
173+ updateall : updatego updatelint updatemod
174+
175+ # Update go version
176+ .PHONY : updatego
177+ updatego :
178+ $(eval LAST_GO_TOOLCHAIN=$(shell curl -s https://go.dev/dl/ | grep -oP 'go[0-9]+\.[0-9]+\.[0-9]+\.linux-amd64\.tar\.gz' | head -n 1 | grep -oP 'go[0-9]+\.[0-9]+\.[0-9]+') )
179+ $(eval LAST_GO_VERSION=$(shell echo ${LAST_GO_TOOLCHAIN} | grep -oP '[0-9]+\.[0-9]+') )
180+ sed -i " s|^go [0-9]*\.[0-9]*$$ |go ${LAST_GO_VERSION} |g" ../go.mod
181+ sed -i " s|^toolchain go[0-9]*\.[0-9]*\.[0-9]*$$ |toolchain ${LAST_GO_TOOLCHAIN} |g" ../go.mod
182+
183+ # Update linter version
184+ .PHONY : updatelint
185+ updatelint :
186+ $(eval LAST_GOLANGCILINT_VERSION=$(shell curl -sL https://github.com/golangci/golangci-lint/releases/latest | grep -oP '<title>Release \Kv[0-9]+\.[0-9]+\.[0-9]+') )
187+ sed -i " s|^GOLANGCILINTVERSION=v[0-9]*\.[0-9]*\.[0-9]*$$ |GOLANGCILINTVERSION=${LAST_GOLANGCILINT_VERSION} |g" Makefile
188+
189+ # Update dependencies
190+ .PHONY : updatemod
191+ updatemod :
192+ # $(GO) get $(shell $(GO) list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)
193+ $(GO ) get -t -u ./... && go mod tidy -compat=$(shell grep -oP 'go \K[0-9]+\.[0-9]+' ../go.mod)
0 commit comments