@@ -72,14 +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 qa : Run all tests and static analysis tools"
82- @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"
8387 @echo " "
8488 @echo " Use DEVMODE=LOCAL for human friendly output."
8589 @echo " "
@@ -159,3 +163,26 @@ test: ensuretarget
159163 -coverprofile=target/report/coverage.out \
160164 -v $(SRCDIR ) $(TESTEXTRACMD )
161165 @echo -e " \n\n>>> END: Unit Tests <<<\n\n"
166+
167+ # Update everything
168+ .PHONY : updateall
169+ updateall : updatego updatelint updatemod
170+
171+ # Update go version
172+ .PHONY : updatego
173+ updatego :
174+ $(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]+') )
175+ $(eval LAST_GO_VERSION=$(shell echo ${LAST_GO_TOOLCHAIN} | grep -oP '[0-9]+\.[0-9]+') )
176+ sed -i " s|^go [0-9]*\.[0-9]*$$ |go ${LAST_GO_VERSION} |g" ../go.mod
177+ sed -i " s|^toolchain go[0-9]*\.[0-9]*\.[0-9]*$$ |toolchain ${LAST_GO_TOOLCHAIN} |g" ../go.mod
178+
179+ # Update linter version
180+ .PHONY : updatelint
181+ updatelint :
182+ $(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]+') )
183+ sed -i " s|^GOLANGCILINTVERSION=v[0-9]*\.[0-9]*\.[0-9]*$$ |GOLANGCILINTVERSION=${LAST_GOLANGCILINT_VERSION} |g" Makefile
184+
185+ # Update dependencies
186+ .PHONY : updatemod
187+ updatemod :
188+ $(GO ) get -t -u ./... && go mod tidy -compat=$(shell grep -oP 'go \K[0-9]+\.[0-9]+' ../go.mod)
0 commit comments