build: Improve update-deps command, update deps (#8540)

This commit is contained in:
Jakob Borg
2022-09-14 10:29:44 +02:00
committed by GitHub
parent 6cac308bcd
commit 39d3424e34
3 changed files with 92 additions and 87 deletions

View File

@@ -884,8 +884,20 @@ func shouldRebuildAssets(target, srcdir string) bool {
}
func updateDependencies() {
runPrint(goCmd, "get", "-u", "./cmd/...")
runPrint(goCmd, "mod", "tidy", "-go=1.17", "-compat=1.17")
// Figure out desired Go version
bs, err := os.ReadFile("go.mod")
if err != nil {
log.Fatal(err)
}
re := regexp.MustCompile(`(?m)^go\s+([0-9.]+)`)
matches := re.FindSubmatch(bs)
if len(matches) != 2 {
log.Fatal("failed to parse go.mod")
}
goVersion := string(matches[1])
runPrint(goCmd, "get", "-u", "all")
runPrint(goCmd, "mod", "tidy", "-go="+goVersion, "-compat="+goVersion)
// We might have updated the protobuf package and should regenerate to match.
proto()