aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorLuke de Waal <[email protected]>2022-03-20 16:24:37 +0100
committerBjørn Erik Pedersen <[email protected]>2022-03-20 22:07:26 +0100
commit5adb81ce39a36214712762288c6aab9ebcff5e24 (patch)
tree662ed01406473d8ba90c137455ca52abca828146 /modules
parent1c0e7c1ae1eb9cd47fbe030ebddbf89df04fe667 (diff)
downloadhugo-5adb81ce39a36214712762288c6aab9ebcff5e24.tar.gz
hugo-5adb81ce39a36214712762288c6aab9ebcff5e24.zip
Support '-u=patch' in hugo mod get
The control-flow for running `hugo mod get` was adapted to allow for passing `-u=patch` instead of only being able to pass `-u`. Fixes #9127
Diffstat (limited to 'modules')
-rw-r--r--modules/client.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/client.go b/modules/client.go
index fe0abc462..eab871d01 100644
--- a/modules/client.go
+++ b/modules/client.go
@@ -305,8 +305,9 @@ func (c *Client) Vendor() error {
// Get runs "go get" with the supplied arguments.
func (c *Client) Get(args ...string) error {
- if len(args) == 0 || (len(args) == 1 && args[0] == "-u") {
+ if len(args) == 0 || (len(args) == 1 && strings.Contains(args[0], "-u")) {
update := len(args) != 0
+ patch := update && (args[0] == "-u=patch") //
// We need to be explicit about the modules to get.
for _, m := range c.moduleConfig.Imports {
@@ -318,10 +319,14 @@ func (c *Client) Get(args ...string) error {
continue
}
var args []string
- if update {
+
+ if update && !patch {
args = append(args, "-u")
+ } else if update && patch {
+ args = append(args, "-u=patch")
}
args = append(args, m.Path)
+
if err := c.get(args...); err != nil {
return err
}