diff --git a/go.mod b/go.mod index 26281da9e..62f9142b6 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/vmware-tanzu/tanzu-plugin-runtime v0.90.0 golang.org/x/crypto v0.14.0 gopkg.in/yaml.v2 v2.4.0 - gotest.tools/v3 v3.5.0 + gotest.tools/v3 v3.5.1 k8s.io/api v0.26.3 k8s.io/apiextensions-apiserver v0.26.2 k8s.io/apimachinery v0.27.3 diff --git a/go.sum b/go.sum index 4d8a8fe8c..d66a0eedd 100644 --- a/go.sum +++ b/go.sum @@ -1183,8 +1183,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= -gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= -gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/gotest.tools/v3/internal/assert/result.go b/vendor/gotest.tools/v3/internal/assert/result.go index 360320614..bb8741eb4 100644 --- a/vendor/gotest.tools/v3/internal/assert/result.go +++ b/vendor/gotest.tools/v3/internal/assert/result.go @@ -26,7 +26,7 @@ func RunComparison( return true } - if source.Update { + if source.IsUpdate() { if updater, ok := result.(updateExpected); ok { const stackIndex = 3 // Assert/Check, assert, RunComparison err := updater.UpdatedExpected(stackIndex) diff --git a/vendor/gotest.tools/v3/internal/source/update.go b/vendor/gotest.tools/v3/internal/source/update.go index f2006aacf..5591bffd1 100644 --- a/vendor/gotest.tools/v3/internal/source/update.go +++ b/vendor/gotest.tools/v3/internal/source/update.go @@ -14,12 +14,32 @@ import ( "strings" ) -// Update is set by the -update flag. It indicates the user running the tests -// would like to update any golden values. +// IsUpdate is returns true if the -update flag is set. It indicates the user +// running the tests would like to update any golden values. +func IsUpdate() bool { + if Update { + return true + } + return flag.Lookup("update").Value.(flag.Getter).Get().(bool) +} + +// Update is a shim for testing, and for compatibility with the old -update-golden +// flag. var Update bool func init() { - flag.BoolVar(&Update, "update", false, "update golden values") + if f := flag.Lookup("update"); f != nil { + getter, ok := f.Value.(flag.Getter) + msg := "some other package defined an incompatible -update flag, expected a flag.Bool" + if !ok { + panic(msg) + } + if _, ok := getter.Get().(bool); !ok { + panic(msg) + } + return + } + flag.Bool("update", false, "update golden values") } // ErrNotFound indicates that UpdateExpectedValue failed to find the diff --git a/vendor/modules.txt b/vendor/modules.txt index 900ece400..40a87d394 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -654,7 +654,7 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# gotest.tools/v3 v3.5.0 +# gotest.tools/v3 v3.5.1 ## explicit; go 1.17 gotest.tools/v3/assert gotest.tools/v3/assert/cmp