Update github.com/gordonklaus/ineffassign commit hash to 7953dde #233

Merged
konrad merged 1 commits from renovate/github.com-gordonklaus-ineffassign-digest into master 2020-04-07 12:30:58 +00:00
5 changed files with 22 additions and 19 deletions

2
go.mod
View File

@ -41,7 +41,7 @@ require (
github.com/go-xorm/core v0.6.2 // indirect
github.com/go-xorm/xorm v0.7.9 // indirect
github.com/golang/protobuf v1.3.2 // indirect
github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc
github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf
github.com/imdario/mergo v0.3.7
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jgautheron/goconst v0.0.0-20200227150835-cda7ea3bf591

2
go.sum
View File

@ -147,6 +147,8 @@ github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OI
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc h1:cJlkeAx1QYgO5N80aF5xRGstVsRQwgLR7uA2FnP1ZjY=
github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU=
github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf h1:vc7Dmrk4JwS0ZPS6WZvWlwDflgDTA26jItmbSj83nug=
github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=

View File

@ -1,4 +1,4 @@
# ineffassign
Detect ineffectual assignments in Go code.
This tool misses some cases because does not consider any type information in its analysis. (For example, assignments to struct fields are never marked as ineffectual.) It should, however, never give any false positives.
This tool misses some cases because it does not consider any type information in its analysis. (For example, assignments to struct fields are never marked as ineffectual.) It should, however, never give any false positives.

View File

@ -282,18 +282,17 @@ func (bld *builder) Visit(n ast.Node) ast.Visitor {
for _, x := range n.Results {
bld.walk(x)
}
res := bld.results[len(bld.results)-1]
if res == nil {
break
}
for _, f := range res.List {
for _, id := range f.Names {
if n.Results != nil {
bld.assign(id)
if res := bld.results[len(bld.results)-1]; res != nil {
for _, f := range res.List {
for _, id := range f.Names {
if n.Results != nil {
bld.assign(id)
}
bld.use(id)
}
bld.use(id)
}
}
bld.newBlock()
case *ast.SendStmt:
bld.maybePanic()
return bld
@ -368,14 +367,16 @@ func isZeroInitializer(x ast.Expr) bool {
x = c.Args[0]
}
b, ok := x.(*ast.BasicLit)
if !ok {
return false
}
switch b.Value {
case "0", "0.0", "0.", ".0", `""`:
return true
switch x := x.(type) {
case *ast.BasicLit:
switch x.Value {
case "0", "0.0", "0.", ".0", `""`:
return true
}
case *ast.Ident:
return x.Name == "false" && x.Obj == nil
}
return false
}

2
vendor/modules.txt vendored
View File

@ -74,7 +74,7 @@ github.com/go-sql-driver/mysql
github.com/go-testfixtures/testfixtures/v3
# github.com/golang/protobuf v1.3.2
github.com/golang/protobuf/proto
# github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc
# github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf
github.com/gordonklaus/ineffassign
# github.com/hashicorp/hcl v1.0.0
github.com/hashicorp/hcl