Skip to content

Commit

Permalink
renovate: more robust parser for Go version in go.mod
Browse files Browse the repository at this point in the history
Go automatically removes the toolchain when the go version is equal to
the toolchain version so let's do best effort: try to parse the
toolchain directive, if it fails, parse the golang version directive
directly.

Signed-off-by: Mahe Tardy <[email protected]>
  • Loading branch information
mtardy committed Feb 17, 2025
1 parent 6f9a8b7 commit fc759c4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"^make vendor$",
"^make -C install/kubernetes$",
"^go mod vendor$",
"^install-tool golang \\$\\(grep -oP '\\^go \\\\K\\.\\+' go\\.mod\\)$",
"^install-tool golang \\$\\(grep -oP '\\^toolchain go\\\\K\\.\\+' go\\.mod\\)$",
"^install-tool golang \\$\\(grep -oP '\\^toolchain go\\\\K\\.\\+\\$' go.mod \\|\\| grep -oP '\\^go \\\\K\\.\\+\\$' go.mod\\)$",
"^make metrics-docs$",
],
// repository configuration
Expand Down Expand Up @@ -233,7 +232,7 @@
// We need to trigger a golang install manually here because in some
// cases it might not be preinstalled, see:
// https://github.com/renovatebot/renovate/discussions/23485
"commands": ["install-tool golang $(grep -oP '^toolchain go\\K.+' go.mod)", "make vendor"],
"commands": ["install-tool golang $(grep -oP '^toolchain go\\K.+$' go.mod || grep -oP '^go \\K.+$' go.mod)", "make vendor"],
"fileFilters": ["**/**"],
"executionMode": "branch"
},
Expand All @@ -254,7 +253,7 @@
// We need to trigger a golang install manually here because in some
// cases it might not be preinstalled, see:
// https://github.com/renovatebot/renovate/discussions/23485
"commands": ["install-tool golang $(grep -oP '^go \\K.+' go.mod)", "make vendor"],
"commands": ["install-tool golang $(grep -oP '^toolchain go\\K.+$' go.mod || grep -oP '^go \\K.+$' go.mod)", "make vendor"],
"fileFilters": ["**/**"],
"executionMode": "branch"
},
Expand Down

0 comments on commit fc759c4

Please sign in to comment.