Skip to content

Commit

Permalink
Bump gotest.tools/v3 from 3.5.0 to 3.5.1
Browse files Browse the repository at this point in the history
Bumps [gotest.tools/v3](https://github.com/gotestyourself/gotest.tools) from 3.5.0 to 3.5.1.
- [Release notes](https://github.com/gotestyourself/gotest.tools/releases)
- [Commits](gotestyourself/gotest.tools@v3.5.0...v3.5.1)

---
updated-dependencies:
- dependency-name: gotest.tools/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
  • Loading branch information
dependabot[bot] authored and tekton-robot committed Sep 19, 2023
1 parent 2947031 commit e79ef26
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
golang.org/x/mod v0.12.0
golang.org/x/sync v0.3.0
gomodules.xyz/jsonpatch/v2 v2.4.0
gotest.tools/v3 v3.5.0
gotest.tools/v3 v3.5.1
k8s.io/api v0.27.4
k8s.io/apiextensions-apiserver v0.27.4
k8s.io/apimachinery v0.27.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2210,8 +2210,8 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
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=
Expand Down
14 changes: 11 additions & 3 deletions vendor/gotest.tools/v3/golden/golden.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Golden files can be automatically updated to match new values by running
`go test pkgname -update`. To ensure the update is correct
compare the diff of the old expected value to the new expected value.
*/
package golden // import "gotest.tools/v3/golden"
package golden

import (
"bytes"
Expand Down Expand Up @@ -40,11 +40,19 @@ type helperT interface {
// in the environment before running tests.
//
// The default value may change in a future major release.
//
// This does not affect the contents of the golden files themselves. And depending on the
// git settings on your system (or in github action platform default like windows), the
// golden files may contain CRLF line endings. You can avoid this by setting the
// .gitattributes file in your repo to use LF line endings for all files, or just the golden
// files, by adding the following line to your .gitattributes file:
//
// * text=auto eol=lf
var NormalizeCRLFToLF = os.Getenv("GOTESTTOOLS_GOLDEN_NormalizeCRLFToLF") != "false"

// FlagUpdate returns true when the -update flag has been set.
func FlagUpdate() bool {
return source.Update
return source.IsUpdate()
}

// Open opens the file in ./testdata
Expand Down Expand Up @@ -178,7 +186,7 @@ func compare(actual []byte, filename string) (cmp.Result, []byte) {
}

func update(filename string, actual []byte) error {
if !source.Update {
if !source.IsUpdate() {
return nil
}
if dir := filepath.Dir(Path(filename)); dir != "." {
Expand Down
2 changes: 1 addition & 1 deletion vendor/gotest.tools/v3/internal/assert/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 23 additions & 3 deletions vendor/gotest.tools/v3/internal/source/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,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
Expand Down

0 comments on commit e79ef26

Please sign in to comment.