From f68a725d88d43e96a58619d6db7132f6c7aa12ef Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 00:02:04 +0000 Subject: [PATCH] Renovate: Update External dependencies --- go.mod | 4 +- go.sum | 8 ++-- vendor/github.com/alecthomas/kong/README.md | 9 ++++- .../github.com/alecthomas/kong/callbacks.go | 2 +- vendor/github.com/alecthomas/kong/context.go | 39 +++++++++++++------ vendor/github.com/alecthomas/kong/hooks.go | 13 +++++-- vendor/github.com/alecthomas/kong/kong.go | 10 ++--- vendor/modules.txt | 6 +-- 8 files changed, 59 insertions(+), 32 deletions(-) diff --git a/go.mod b/go.mod index e08f932..df4926b 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,9 @@ module github.com/sapcc/openstack-role-helper go 1.23 require ( - github.com/alecthomas/kong v1.3.0 + github.com/alecthomas/kong v1.4.0 github.com/gophercloud/gophercloud/v2 v2.2.0 - github.com/gophercloud/utils/v2 v2.0.0-20241021065553-b46d0737ee98 + github.com/gophercloud/utils/v2 v2.0.0-20241107125844-da754bc75cd6 github.com/olekukonko/tablewriter v0.0.5 github.com/sapcc/go-bits v0.0.0-20241030155708-d3f315057be8 ) diff --git a/go.sum b/go.sum index 2f8dcbe..fff5223 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,15 @@ github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0= github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= -github.com/alecthomas/kong v1.3.0 h1:YJKuU6/TV2XOBtymafSeuzDvLAFR8cYMZiXVNLhAO6g= -github.com/alecthomas/kong v1.3.0/go.mod h1:IDc8HyiouDdpdiEiY81iaEJM8rSIW6LzX8On4FCO0bE= +github.com/alecthomas/kong v1.4.0 h1:UL7tzGMnnY0YRMMvJyITIRX1EpO6RbBRZDNcCevy3HA= +github.com/alecthomas/kong v1.4.0/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU= github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/gofrs/uuid/v5 v5.3.0 h1:m0mUMr+oVYUdxpMLgSYCZiXe7PuVPnI94+OMeVBNedk= github.com/gofrs/uuid/v5 v5.3.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/gophercloud/gophercloud/v2 v2.2.0 h1:STqqnSXuhcg1OPBOZ14z6JDm8fKIN13H2bJg6bBuHp8= github.com/gophercloud/gophercloud/v2 v2.2.0/go.mod h1:f2hMRC7Kakbv5vM7wSGHrIPZh6JZR60GVHryJlF/K44= -github.com/gophercloud/utils/v2 v2.0.0-20241021065553-b46d0737ee98 h1:4/3x+yL9lcaV1lzwolxOSp/tHVSjn9S+yXh0NiX/vFQ= -github.com/gophercloud/utils/v2 v2.0.0-20241021065553-b46d0737ee98/go.mod h1:9KHhEdDkA/4hTdwxS0sALJIp2hFSjrODlKMQcFU2GFw= +github.com/gophercloud/utils/v2 v2.0.0-20241107125844-da754bc75cd6 h1:Vikb1i71pW5yb/ayp+Cw6Z3Wc+3NtT+ui/t4LyJl7dY= +github.com/gophercloud/utils/v2 v2.0.0-20241107125844-da754bc75cd6/go.mod h1:9KHhEdDkA/4hTdwxS0sALJIp2hFSjrODlKMQcFU2GFw= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= diff --git a/vendor/github.com/alecthomas/kong/README.md b/vendor/github.com/alecthomas/kong/README.md index e3b9fe9..5dbed02 100644 --- a/vendor/github.com/alecthomas/kong/README.md +++ b/vendor/github.com/alecthomas/kong/README.md @@ -663,8 +663,7 @@ func main() { ## Validation Kong does validation on the structure of a command-line, but also supports -extensible validation. Any node in the tree may implement the following -interface: +extensible validation. Any node in the tree may implement either of the following interfaces: ```go type Validatable interface { @@ -672,6 +671,12 @@ type Validatable interface { } ``` +```go +type Validatable interface { + Validate(kctx *kong.Context) error + } +``` + If one of these nodes is in the active command-line it will be called during normal validation. diff --git a/vendor/github.com/alecthomas/kong/callbacks.go b/vendor/github.com/alecthomas/kong/callbacks.go index c84f215..1df975d 100644 --- a/vendor/github.com/alecthomas/kong/callbacks.go +++ b/vendor/github.com/alecthomas/kong/callbacks.go @@ -81,7 +81,7 @@ func callFunction(f reflect.Value, bindings bindings) error { return err } ferr := out[0] - if ferrv := reflect.ValueOf(ferr); !ferrv.IsValid() || ferrv.IsNil() { + if ferrv := reflect.ValueOf(ferr); !ferrv.IsValid() || ((ferrv.Kind() == reflect.Interface || ferrv.Kind() == reflect.Pointer) && ferrv.IsNil()) { return nil } return ferr.(error) //nolint:forcetypeassert diff --git a/vendor/github.com/alecthomas/kong/context.go b/vendor/github.com/alecthomas/kong/context.go index 2ed5d28..8a8c2e1 100644 --- a/vendor/github.com/alecthomas/kong/context.go +++ b/vendor/github.com/alecthomas/kong/context.go @@ -208,7 +208,7 @@ func (c *Context) Validate() error { //nolint: gocyclo desc = node.Path() } if validate := isValidatable(value); validate != nil { - if err := validate.Validate(); err != nil { + if err := validate.Validate(c); err != nil { if desc != "" { return fmt.Errorf("%s: %w", desc, err) } @@ -809,18 +809,22 @@ func (c *Context) RunNode(node *Node, binds ...interface{}) (err error) { func (c *Context) Run(binds ...interface{}) (err error) { node := c.Selected() if node == nil { - if len(c.Path) > 0 { - selected := c.Path[0].Node() - if selected.Type == ApplicationNode { - method := getMethod(selected.Target, "Run") - if method.IsValid() { - return c.RunNode(selected, binds...) - } + if len(c.Path) == 0 { + return fmt.Errorf("no command selected") + } + selected := c.Path[0].Node() + if selected.Type == ApplicationNode { + method := getMethod(selected.Target, "Run") + if method.IsValid() { + node = selected } + } else { + return fmt.Errorf("no command selected") } - return fmt.Errorf("no command selected") } - return c.RunNode(node, binds...) + runErr := c.RunNode(node, binds...) + err = c.Kong.applyHook(c, "AfterRun") + return errors.Join(runErr, err) } // PrintUsage to Kong's stdout. @@ -996,7 +1000,7 @@ func checkEnum(value *Value, target reflect.Value) error { } enums = append(enums, fmt.Sprintf("%q", enum)) } - return fmt.Errorf("%s must be one of %s but got %q", value.ShortSummary(), strings.Join(enums, ","), target.Interface()) + return fmt.Errorf("%s must be one of %s but got %q", value.ShortSummary(), strings.Join(enums, ","), fmt.Sprintf("%v", target.Interface())) } } @@ -1094,12 +1098,23 @@ func findPotentialCandidates(needle string, haystack []string, format string, ar } type validatable interface{ Validate() error } +type extendedValidatable interface { + Validate(kctx *Context) error +} -func isValidatable(v reflect.Value) validatable { +// Proxy a validatable function to the extendedValidatable interface +type validatableFunc func() error + +func (f validatableFunc) Validate(kctx *Context) error { return f() } + +func isValidatable(v reflect.Value) extendedValidatable { if !v.IsValid() || (v.Kind() == reflect.Ptr || v.Kind() == reflect.Slice || v.Kind() == reflect.Map) && v.IsNil() { return nil } if validate, ok := v.Interface().(validatable); ok { + return validatableFunc(validate.Validate) + } + if validate, ok := v.Interface().(extendedValidatable); ok { return validate } if v.CanAddr() { diff --git a/vendor/github.com/alecthomas/kong/hooks.go b/vendor/github.com/alecthomas/kong/hooks.go index d166b08..9fdf24c 100644 --- a/vendor/github.com/alecthomas/kong/hooks.go +++ b/vendor/github.com/alecthomas/kong/hooks.go @@ -3,17 +3,24 @@ package kong // BeforeResolve is a documentation-only interface describing hooks that run before resolvers are applied. type BeforeResolve interface { // This is not the correct signature - see README for details. - BeforeResolve(args ...interface{}) error + BeforeResolve(args ...any) error } // BeforeApply is a documentation-only interface describing hooks that run before values are set. type BeforeApply interface { // This is not the correct signature - see README for details. - BeforeApply(args ...interface{}) error + BeforeApply(args ...any) error } // AfterApply is a documentation-only interface describing hooks that run after values are set. type AfterApply interface { // This is not the correct signature - see README for details. - AfterApply(args ...interface{}) error + AfterApply(args ...any) error +} + +// AfterRun is a documentation-only interface describing hooks that run after Run() returns. +type AfterRun interface { + // This is not the correct signature - see README for details. + // AfterRun is called after Run() returns. + AfterRun(args ...any) error } diff --git a/vendor/github.com/alecthomas/kong/kong.go b/vendor/github.com/alecthomas/kong/kong.go index 10235d0..45479be 100644 --- a/vendor/github.com/alecthomas/kong/kong.go +++ b/vendor/github.com/alecthomas/kong/kong.go @@ -249,19 +249,19 @@ func (k *Kong) interpolateValue(value *Value, vars Vars) (err error) { return fmt.Errorf("enum for %s: %s", value.Summary(), err) } - updatedVars := map[string]string{ - "default": value.Default, - "enum": value.Enum, - } if value.Default, err = interpolate(value.Default, vars, nil); err != nil { return fmt.Errorf("default value for %s: %s", value.Summary(), err) } if value.Enum, err = interpolate(value.Enum, vars, nil); err != nil { return fmt.Errorf("enum value for %s: %s", value.Summary(), err) } + updatedVars := map[string]string{ + "default": value.Default, + "enum": value.Enum, + } if value.Flag != nil { for i, env := range value.Flag.Envs { - if value.Flag.Envs[i], err = interpolate(env, vars, nil); err != nil { + if value.Flag.Envs[i], err = interpolate(env, vars, updatedVars); err != nil { return fmt.Errorf("env value for %s: %s", value.Summary(), err) } } diff --git a/vendor/modules.txt b/vendor/modules.txt index f69fe7c..29985cd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,5 +1,5 @@ -# github.com/alecthomas/kong v1.3.0 -## explicit; go 1.18 +# github.com/alecthomas/kong v1.4.0 +## explicit; go 1.20 github.com/alecthomas/kong # github.com/gofrs/uuid/v5 v5.3.0 ## explicit; go 1.19 @@ -16,7 +16,7 @@ github.com/gophercloud/gophercloud/v2/openstack/identity/v3/roles github.com/gophercloud/gophercloud/v2/openstack/identity/v3/tokens github.com/gophercloud/gophercloud/v2/openstack/utils github.com/gophercloud/gophercloud/v2/pagination -# github.com/gophercloud/utils/v2 v2.0.0-20241021065553-b46d0737ee98 +# github.com/gophercloud/utils/v2 v2.0.0-20241107125844-da754bc75cd6 ## explicit; go 1.22 github.com/gophercloud/utils/v2/client github.com/gophercloud/utils/v2/env