Skip to content

Commit a4492c9

Browse files
committed
Simplify the packager tracker script
1 parent f86425c commit a4492c9

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

packagetracker/Makefile

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
1-
.PHONY: go-mod-download
2-
go-mod-download:
3-
@cp ./go.mod.tpl ./go.mod
4-
@go mod download
5-
6-
.PHONY: go-mod-outdated
7-
go-mod-outdated: go-mod-download
8-
@# https://stackoverflow.com/questions/55866604/whats-the-go-mod-equivalent-of-npm-outdated
9-
@# Since go 1.21, this command will exit 2 when one of the dependencies require a go version newer than us.
10-
@# This implies we have to use the latest verion of Go whenever possible.
11-
@go list -u -m -f '{{if .Update}}{{if not .Indirect}}{{.}}{{end}}{{end}}' all
12-
131
.PHONY: check-if-new-version-available
142
check-if-new-version-available:
3+
@cp ./go.mod.tpl ./go.mod
4+
@go mod download
155
@# If grep matches something, it exits 0, otherwise it exits 1.
166
@# In our case, we want to invert the exit code.
17-
$(MAKE) go-mod-outdated | grep "."; status_code=$$?; if [ $$status_code -eq 0 ]; then exit 1; else exit 0; fi;
7+
go list -u -m -f '{{if .Update}}{{if not .Indirect}}{{.}}{{end}}{{end}}' all | grep "."; status_code=$$?; if [ $$status_code -eq 0 ]; then exit 1; else exit 0; fi;

0 commit comments

Comments
 (0)