aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/alecthomas
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-03-04 17:40:11 +0000
committerTaras Madan <tarasmadan@google.com>2024-03-04 18:34:55 +0000
commit5fc5366972c874b919f93165bb4ed4e2bcb7c350 (patch)
tree287c3361a0dee0c72af80d9a1a66714a06e98a62 /vendor/github.com/alecthomas
parent1be5ce38a9059c356eb193a8c34d60d61c9fc31f (diff)
mod: bump github.com/golangci/golangci-lint from 1.55.2 to 1.56.2
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.55.2 to 1.56.2. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.55.2...v1.56.2) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
Diffstat (limited to 'vendor/github.com/alecthomas')
-rw-r--r--vendor/github.com/alecthomas/go-check-sumtype/decl.go1
-rw-r--r--vendor/github.com/alecthomas/go-check-sumtype/def.go16
2 files changed, 17 insertions, 0 deletions
diff --git a/vendor/github.com/alecthomas/go-check-sumtype/decl.go b/vendor/github.com/alecthomas/go-check-sumtype/decl.go
index ea2cd06df..9dec9eefd 100644
--- a/vendor/github.com/alecthomas/go-check-sumtype/decl.go
+++ b/vendor/github.com/alecthomas/go-check-sumtype/decl.go
@@ -57,6 +57,7 @@ func findSumTypeDecls(pkgs []*packages.Package) ([]sumTypeDecl, error) {
}
pos = pkg.Fset.Position(tspec.Pos())
decl := sumTypeDecl{Package: pkg, TypeName: tspec.Name.Name, Pos: pos}
+ debugf("found sum type decl: %s.%s", decl.Package.PkgPath, decl.TypeName)
decls = append(decls, decl)
break
}
diff --git a/vendor/github.com/alecthomas/go-check-sumtype/def.go b/vendor/github.com/alecthomas/go-check-sumtype/def.go
index 811b98f98..24729ac01 100644
--- a/vendor/github.com/alecthomas/go-check-sumtype/def.go
+++ b/vendor/github.com/alecthomas/go-check-sumtype/def.go
@@ -1,11 +1,21 @@
package gochecksumtype
import (
+ "flag"
"fmt"
"go/token"
"go/types"
+ "log"
)
+var debug = flag.Bool("debug", false, "enable debug logging")
+
+func debugf(format string, args ...interface{}) {
+ if *debug {
+ log.Printf(format, args...)
+ }
+}
+
// Error as returned by Run()
type Error interface {
error
@@ -107,6 +117,7 @@ func newSumTypeDef(pkg *types.Package, decl sumTypeDecl) (*sumTypeDef, error) {
Decl: decl,
Ty: iface,
}
+ debugf("searching for variants of %s.%s\n", pkg.Path(), decl.TypeName)
for _, name := range pkg.Scope().Names() {
obj, ok := pkg.Scope().Lookup(name).(*types.TypeName)
if !ok {
@@ -116,7 +127,12 @@ func newSumTypeDef(pkg *types.Package, decl sumTypeDecl) (*sumTypeDef, error) {
if types.Identical(ty.Underlying(), iface) {
continue
}
+ // Skip generic types.
+ if named, ok := ty.(*types.Named); ok && named.TypeParams() != nil {
+ continue
+ }
if types.Implements(ty, iface) || types.Implements(types.NewPointer(ty), iface) {
+ debugf(" found variant: %s.%s\n", pkg.Path(), obj.Name())
def.Variants = append(def.Variants, obj)
}
}