1
0

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

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

Reviewed-on: https://kolaente.dev/vikunja/api/pulls/233
This commit is contained in:
renovate
2020-04-07 12:30:57 +00:00
committed by konrad
parent 1e5a1b4892
commit fd7dd47d5e
5 changed files with 22 additions and 19 deletions

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