From e3f16ca50d9816ad40104091cc68c3a8b290b118 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 23:02:17 +0000 Subject: [PATCH] :seedling: Bump github.com/maxbrunsfeld/counterfeiter/v6 Bumps [github.com/maxbrunsfeld/counterfeiter/v6](https://github.com/maxbrunsfeld/counterfeiter) from 6.11.3 to 6.12.0. - [Release notes](https://github.com/maxbrunsfeld/counterfeiter/releases) - [Commits](https://github.com/maxbrunsfeld/counterfeiter/compare/v6.11.3...v6.12.0) --- updated-dependencies: - dependency-name: github.com/maxbrunsfeld/counterfeiter/v6 dependency-version: 6.12.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 6 +- go.sum | 12 ++-- .../counterfeiter/v6/generator/fake.go | 66 +++++++++++++++++++ .../v6/generator/interface_template.go | 15 +++-- .../counterfeiter/v6/generator/loader.go | 4 ++ vendor/modules.txt | 12 ++-- 6 files changed, 95 insertions(+), 20 deletions(-) diff --git a/go.mod b/go.mod index f0a9732362..2b5bbefb5d 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.7.0 github.com/itchyny/gojq v0.12.17 - github.com/maxbrunsfeld/counterfeiter/v6 v6.11.3 + github.com/maxbrunsfeld/counterfeiter/v6 v6.12.0 github.com/mitchellh/hashstructure v1.1.0 github.com/mitchellh/mapstructure v1.5.0 github.com/onsi/ginkgo/v2 v2.25.2 @@ -34,7 +34,7 @@ require ( github.com/spf13/pflag v1.0.9 github.com/stretchr/testify v1.11.1 golang.org/x/net v0.43.0 - golang.org/x/sync v0.16.0 + golang.org/x/sync v0.17.0 golang.org/x/time v0.12.0 google.golang.org/grpc v1.75.0 gopkg.in/yaml.v2 v2.4.0 @@ -166,7 +166,7 @@ require ( golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sys v0.35.0 // indirect golang.org/x/term v0.34.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/text v0.29.0 // indirect golang.org/x/tools v0.36.0 // indirect golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index ae57c2aea1..e9d8dd9faa 100644 --- a/go.sum +++ b/go.sum @@ -1795,8 +1795,8 @@ github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs= github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= -github.com/maxbrunsfeld/counterfeiter/v6 v6.11.3 h1:Eaq36EIyJNp7b3qDhjV7jmDVq/yPeW2v4pTqzGbOGB4= -github.com/maxbrunsfeld/counterfeiter/v6 v6.11.3/go.mod h1:6KKUoQBZBW6PDXJtNfqeEjPXMj/ITTk+cWK9t9uS5+E= +github.com/maxbrunsfeld/counterfeiter/v6 v6.12.0 h1:aOeI7xAOVdK+R6xbVsZuU9HmCZYmQVmZgPf9xJUd2Sg= +github.com/maxbrunsfeld/counterfeiter/v6 v6.12.0/go.mod h1:0hZWbtfeCYUQeAQdPLUzETiBhUSns7O6LDj9vH88xKA= github.com/miekg/pkcs11 v1.1.1 h1:Ugu9pdy6vAYku5DEpVWVFPYnzV+bxB+iRdbuFSu7TvU= github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= @@ -2296,8 +2296,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= -golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -2427,8 +2427,8 @@ golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= +golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/vendor/github.com/maxbrunsfeld/counterfeiter/v6/generator/fake.go b/vendor/github.com/maxbrunsfeld/counterfeiter/v6/generator/fake.go index 5c2a6fd1ac..fbdad7b359 100644 --- a/vendor/github.com/maxbrunsfeld/counterfeiter/v6/generator/fake.go +++ b/vendor/github.com/maxbrunsfeld/counterfeiter/v6/generator/fake.go @@ -104,6 +104,72 @@ func (f *Fake) IsFunction() bool { return ok } +// IsConstraintInterface indicates whether the interface is a constraint interface +// (contains type constraints like ~string) which cannot be implemented by concrete types. +func (f *Fake) IsConstraintInterface() bool { + if !f.IsInterface() { + return false + } + + iface, ok := f.Target.Type().Underlying().(*types.Interface) + if !ok { + return false + } + + // check if the interface has any type constraints + for i := 0; i < iface.NumEmbeddeds(); i++ { + if _, ok := iface.EmbeddedType(i).(*types.Union); ok { + return true + } + } + + // check for approximation constraints by examining the string representation + // a bit of a hack, but the Go types API doesn't expose type constraints cleanly + return strings.Contains(iface.String(), "~") +} + +// HasConstraintInterface indicates whether any of the generic type constraints +// are constraint interfaces that cannot be used in type assertions. +func (f *Fake) HasConstraintInterface() bool { + if f.Target == nil || f.Target.Type() == nil { + return false + } + + named, ok := f.Target.Type().(*types.Named) + if !ok { + return false + } + + typeParams := named.TypeParams() + if typeParams.Len() == 0 { + return false + } + + for i := 0; i < typeParams.Len(); i++ { + param := typeParams.At(i) + constraint := param.Constraint() + + // check if the constraint is a constraint interface + if iface, ok := constraint.Underlying().(*types.Interface); ok { + // check if this interface contains type constraints + for j := 0; j < iface.NumEmbeddeds(); j++ { + if _, ok := iface.EmbeddedType(j).(*types.Union); ok { + return true + } + } + + // check for approximation constraints by examining the string representation + // a bit of a hack, but the Go types API doesn't expose type constraints cleanly + constraintStr := constraint.String() + if strings.Contains(constraintStr, "~") { + return true + } + } + } + + return false +} + func unexport(s string) string { s = strings.TrimSpace(s) if s == "" { diff --git a/vendor/github.com/maxbrunsfeld/counterfeiter/v6/generator/interface_template.go b/vendor/github.com/maxbrunsfeld/counterfeiter/v6/generator/interface_template.go index 3cd2ccfe5b..1a946f8075 100644 --- a/vendor/github.com/maxbrunsfeld/counterfeiter/v6/generator/interface_template.go +++ b/vendor/github.com/maxbrunsfeld/counterfeiter/v6/generator/interface_template.go @@ -10,12 +10,15 @@ import ( var title = cases.Title(language.Und, cases.NoLower) +var hasConstraintInterface = func(f *Fake) bool { return f.HasConstraintInterface() } + var interfaceFuncs = template.FuncMap{ - "ToLower": strings.ToLower, - "UnExport": unexport, - "Replace": strings.Replace, - "IsExported": isExported, - "Title": title.String, + "ToLower": strings.ToLower, + "UnExport": unexport, + "Replace": strings.Replace, + "IsExported": isExported, + "Title": title.String, + "HasConstraintInterface": hasConstraintInterface, } const interfaceTemplate string = `{{.Header}}// Code generated by counterfeiter. DO NOT EDIT. @@ -167,6 +170,8 @@ func (fake *{{.Name}}{{$.GenericTypeParameters}}) recordInvocation(key string, a } {{if IsExported .TargetName -}} +{{if not (HasConstraintInterface .) -}} var _ {{.TargetAlias}}.{{.TargetName}}{{.GenericTypeConstraints}} = new({{.Name}}{{.GenericTypeConstraints}}) {{- end}} +{{- end}} ` diff --git a/vendor/github.com/maxbrunsfeld/counterfeiter/v6/generator/loader.go b/vendor/github.com/maxbrunsfeld/counterfeiter/v6/generator/loader.go index 106ddfbd58..08233b0d62 100644 --- a/vendor/github.com/maxbrunsfeld/counterfeiter/v6/generator/loader.go +++ b/vendor/github.com/maxbrunsfeld/counterfeiter/v6/generator/loader.go @@ -138,6 +138,10 @@ func (f *Fake) findPackage() error { if !f.IsInterface() && !f.IsFunction() { return fmt.Errorf("cannot generate a fake for %s because it is not an interface or function", f.TargetName) } + + if f.IsConstraintInterface() { + return fmt.Errorf("cannot generate a fake for %s because it is a constraint interface (contains type constraints like ~string) which cannot be implemented by concrete types", f.TargetName) + } } if f.IsInterface() { diff --git a/vendor/modules.txt b/vendor/modules.txt index 92cb6ad56e..b6e3a4d8f9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -430,8 +430,8 @@ github.com/mattn/go-isatty # github.com/mattn/go-sqlite3 v1.14.32 ## explicit; go 1.19 github.com/mattn/go-sqlite3 -# github.com/maxbrunsfeld/counterfeiter/v6 v6.11.3 -## explicit; go 1.23.0 +# github.com/maxbrunsfeld/counterfeiter/v6 v6.12.0 +## explicit; go 1.24.0 github.com/maxbrunsfeld/counterfeiter/v6 github.com/maxbrunsfeld/counterfeiter/v6/arguments github.com/maxbrunsfeld/counterfeiter/v6/command @@ -805,8 +805,8 @@ golang.org/x/net/websocket ## explicit; go 1.23.0 golang.org/x/oauth2 golang.org/x/oauth2/internal -# golang.org/x/sync v0.16.0 -## explicit; go 1.23.0 +# golang.org/x/sync v0.17.0 +## explicit; go 1.24.0 golang.org/x/sync/errgroup golang.org/x/sync/semaphore golang.org/x/sync/singleflight @@ -820,8 +820,8 @@ golang.org/x/sys/windows/registry # golang.org/x/term v0.34.0 ## explicit; go 1.23.0 golang.org/x/term -# golang.org/x/text v0.28.0 -## explicit; go 1.23.0 +# golang.org/x/text v0.29.0 +## explicit; go 1.24.0 golang.org/x/text/cases golang.org/x/text/encoding golang.org/x/text/encoding/charmap