aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-toolsmith
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-09-15 18:05:35 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-09-15 19:34:30 +0200
commit712de1c63d9db97c81af68cd0dc4372c53d2e57a (patch)
treeae1761fec52c3ae4ddd003a4130ddbda8d0a2d69 /vendor/github.com/go-toolsmith
parent298a69c38dd5c8a9bbd7a022e88f4ddbcf885e16 (diff)
vendor/github.com/golangci/golangci-lint: update to v1.31
Diffstat (limited to 'vendor/github.com/go-toolsmith')
-rw-r--r--vendor/github.com/go-toolsmith/typep/.travis.yml2
-rw-r--r--vendor/github.com/go-toolsmith/typep/README.md2
-rw-r--r--vendor/github.com/go-toolsmith/typep/predicates.go2
-rw-r--r--vendor/github.com/go-toolsmith/typep/safeExpr.go11
4 files changed, 14 insertions, 3 deletions
diff --git a/vendor/github.com/go-toolsmith/typep/.travis.yml b/vendor/github.com/go-toolsmith/typep/.travis.yml
index c32ac0062..d3ff3cca8 100644
--- a/vendor/github.com/go-toolsmith/typep/.travis.yml
+++ b/vendor/github.com/go-toolsmith/typep/.travis.yml
@@ -5,5 +5,5 @@ install:
- # Prevent default install action "go get -t -v ./...".
script:
- go get -t -v ./...
- - go tool vet .
+ - go vet ./...
- go test -v -race ./...
diff --git a/vendor/github.com/go-toolsmith/typep/README.md b/vendor/github.com/go-toolsmith/typep/README.md
index 736658012..f7979148f 100644
--- a/vendor/github.com/go-toolsmith/typep/README.md
+++ b/vendor/github.com/go-toolsmith/typep/README.md
@@ -1,6 +1,6 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/go-toolsmith/typep)](https://goreportcard.com/report/github.com/go-toolsmith/typep)
[![GoDoc](https://godoc.org/github.com/go-toolsmith/typep?status.svg)](https://godoc.org/github.com/go-toolsmith/typep)
-
+[![Build Status](https://travis-ci.org/go-toolsmith/typep.svg?branch=master)](https://travis-ci.org/go-toolsmith/typep)
# typep
diff --git a/vendor/github.com/go-toolsmith/typep/predicates.go b/vendor/github.com/go-toolsmith/typep/predicates.go
index 70e5b55cd..b07325a72 100644
--- a/vendor/github.com/go-toolsmith/typep/predicates.go
+++ b/vendor/github.com/go-toolsmith/typep/predicates.go
@@ -27,7 +27,7 @@ func IsTypeExpr(info *types.Info, x ast.Expr) bool {
_, ok := info.ObjectOf(x).(*types.TypeName)
return ok
- case *ast.FuncType, *ast.StructType, *ast.InterfaceType, *ast.ArrayType, *ast.MapType:
+ case *ast.FuncType, *ast.StructType, *ast.InterfaceType, *ast.ArrayType, *ast.MapType, *ast.ChanType:
return true
default:
diff --git a/vendor/github.com/go-toolsmith/typep/safeExpr.go b/vendor/github.com/go-toolsmith/typep/safeExpr.go
index 7236e6e03..d5835d97b 100644
--- a/vendor/github.com/go-toolsmith/typep/safeExpr.go
+++ b/vendor/github.com/go-toolsmith/typep/safeExpr.go
@@ -20,6 +20,10 @@ func SideEffectFree(info *types.Info, expr ast.Expr) bool {
// whitelist to be on the conservative side.
// Can be extended as needed.
+ if expr == nil {
+ return true
+ }
+
switch expr := expr.(type) {
case *ast.StarExpr:
return SideEffectFree(info, expr.X)
@@ -31,6 +35,11 @@ func SideEffectFree(info *types.Info, expr ast.Expr) bool {
SideEffectFree(info, expr.X)
case *ast.BasicLit, *ast.Ident:
return true
+ case *ast.SliceExpr:
+ return SideEffectFree(info, expr.X) &&
+ SideEffectFree(info, expr.Low) &&
+ SideEffectFree(info, expr.High) &&
+ SideEffectFree(info, expr.Max)
case *ast.IndexExpr:
return SideEffectFree(info, expr.X) &&
SideEffectFree(info, expr.Index)
@@ -38,6 +47,8 @@ func SideEffectFree(info *types.Info, expr ast.Expr) bool {
return SideEffectFree(info, expr.X)
case *ast.ParenExpr:
return SideEffectFree(info, expr.X)
+ case *ast.TypeAssertExpr:
+ return SideEffectFree(info, expr.X)
case *ast.CompositeLit:
return SideEffectFreeList(info, expr.Elts)
case *ast.CallExpr: