mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
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
This commit is contained in:
parent
1c0e7c1ae1
commit
5adb81ce39
1 changed files with 7 additions and 2 deletions
|
@ -305,8 +305,9 @@ func (c *Client) Vendor() error {
|
||||||
|
|
||||||
// Get runs "go get" with the supplied arguments.
|
// Get runs "go get" with the supplied arguments.
|
||||||
func (c *Client) Get(args ...string) error {
|
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
|
update := len(args) != 0
|
||||||
|
patch := update && (args[0] == "-u=patch") //
|
||||||
|
|
||||||
// We need to be explicit about the modules to get.
|
// We need to be explicit about the modules to get.
|
||||||
for _, m := range c.moduleConfig.Imports {
|
for _, m := range c.moduleConfig.Imports {
|
||||||
|
@ -318,10 +319,14 @@ func (c *Client) Get(args ...string) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
var args []string
|
var args []string
|
||||||
if update {
|
|
||||||
|
if update && !patch {
|
||||||
args = append(args, "-u")
|
args = append(args, "-u")
|
||||||
|
} else if update && patch {
|
||||||
|
args = append(args, "-u=patch")
|
||||||
}
|
}
|
||||||
args = append(args, m.Path)
|
args = append(args, m.Path)
|
||||||
|
|
||||||
if err := c.get(args...); err != nil {
|
if err := c.get(args...); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue