Repository: golang/lint

Issue #63: recent changes cause golint to panic
Created: 2014-09-10T04:57:39Z
ff22a87 causes golint to panic during execution. I tried removing the changes to lint.go in this commit and then golint was able to properly execute without panicking.
Panic output:
$ $HOME/gopath/bin/golint **/*.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x58 pc=0x4ea5d5]
goroutine 1 [running]:
runtime.panic(0x6038a0, 0x8a8cc8)
    /home/travis/.gvm/gos/go1.2.2/src/pkg/runtime/panic.c:266 +0xb6
code.google.com/p/go.tools/go/types.(*Info).TypeOf(0xc2103516e0, 0x7f84366b8690, 0xc210202ae0, 0x7, 0x0)
    /home/travis/gopath/src/code.google.com/p/go.tools/go/types/api.go:219 +0x125
github.com/golang/lint.(*pkg).typeOf(0xc2100bc5a0, 0x7f84366b8690, 0xc210202ae0, 0x4, 0x6b33e0)
    /home/travis/gopath/src/github.com/golang/lint/lint.go:231 +0x62
github.com/golang/lint.func·007(0x7f84366cf980, 0xc2101f9aa0, 0x20b36517a00)
    /home/travis/gopath/src/github.com/golang/lint/lint.go:827 +0x4d3
github.com/golang/lint.walker.Visit(0xc21034e2c0, 0x7f84366cf980, 0xc2101f9aa0, 0x456086, 0x0)
    /home/travis/gopath/src/github.com/golang/lint/lint.go:1185 +0x36
go/ast.Walk(0x7f84366cf6b8, 0xc21034e2c0, 0x7f84366cf980, 0xc2101f9aa0)
    /home/travis/.gvm/gos/go1.2.2/src/pkg/go/ast/walk.go:52 +0x58
go/ast.Walk(0x7f84366cf6b8, 0xc21034e2c0, 0x7f84366cf710, 0xc210200b00)
    /home/travis/.gvm/gos/go1.2.2/src/pkg/go/ast/walk.go:329 +0x2033
go/ast.Walk(0x7f84366cf6b8, 0xc21034e2c0, 0x7f84366cfb30, 0xc2101faad0)
    /home/travis/.gvm/gos/go1.2.2/src/pkg/go/ast/walk.go:186 +0x358a
go/ast.walkStmtList(0x7f84366cf6b8, 0xc21034e2c0, 0xc2101ff580, 0x6, 0x8)
    /home/travis/.gvm/gos/go1.2.2/src/pkg/go/ast/walk.go:32 +0x95
go/ast.Walk(0x7f84366cf6b8, 0xc21034e2c0, 0x7f84366cf4a0, 0xc210205630)
    /home/travis/.gvm/gos/go1.2.2/src/pkg/go/ast/walk.go:224 +0x3e8a
go/ast.Walk(0x7f84366cf6b8, 0xc21034e2c0, 0x7f84366cf800, 0xc210205660)
    /home/travis/.gvm/gos/go1.2.2/src/pkg/go/ast/walk.go:342 +0xbf4
go/ast.walkDeclList(0x7f84366cf6b8, 0xc21034e2c0, 0xc210200fc0, 0x4, 0x4)
    /home/travis/.gvm/gos/go1.2.2/src/pkg/go/ast/walk.go:38 +0x95
go/ast.Walk(0x7f84366cf6b8, 0xc21034e2c0, 0x7f84366ca580, 0xc2101ff700)
    /home/travis/.gvm/gos/go1.2.2/src/pkg/go/ast/walk.go:351 +0x2a52
github.com/golang/lint.(*file).walk(0xc210207640, 0xc21034e2c0)
    /home/travis/gopath/src/github.com/golang/lint/lint.go:1161 +0x64
github.com/golang/lint.(*file).lintVarDecls(0xc210207640)
    /home/travis/gopath/src/github.com/golang/lint/lint.go:852 +0x8c
github.com/golang/lint.(*file).lint(0xc210207640)
    /home/travis/gopath/src/github.com/golang/lint/lint.go:145 +0x6d
github.com/golang/lint.(*pkg).lint(0xc2100bc5a0, 0xc2100ad7b0, 0x7fff0d67cd84, 0x12)
    /home/travis/gopath/src/github.com/golang/lint/lint.go:122 +0xb6
github.com/golang/lint.(*Linter).LintFiles(0x7f8436518d38, 0xc21003ab40, 0x7fff0d67cea5, 0x17, 0xc2100a9000, ...)
    /home/travis/gopath/src/github.com/golang/lint/lint.go:79 +0x309
main.lintFiles(0xc21000a010, 0x55, 0x55)
    /home/travis/gopath/src/github.com/golang/lint/golint/golint.go:76 +0x1f1
main.main()
    /home/travis/gopath/src/github.com/golang/lint/golint/golint.go:50 +0x17b

Source: https://travis-ci.org/natebrennand/twiliogo/builds/34879381

Duplicate issue #64: Golint crashes with a large number of input files
Created: 2014-09-10T15:46:19Z
I tried to use find and xargs with golint but it crashes. If I pass -L 1 to xargs it runs just fine.
ericu@ericu-trusty-ubuntu:~/rtb/src/spiceworks.com/rtb$ find . -type f -name '*.go' | xargs  golint
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x58 pc=0x50e064]
goroutine 16 [running]:
runtime.panic(0x657b80, 0x7d76d3)
/home/ericu/builds/go/src/pkg/runtime/panic.c:279 +0xf5
code.google.com/p/go.tools/go/types.(_Info).TypeOf(0xc208bc39f0, 0x7fd71cdcfc70, 0xc208b950c0, 0x0, 0x0)
/home/ericu/rtb/src/code.google.com/p/go.tools/go/types/api.go:219 +0x194
github.com/golang/lint.(_pkg).typeOf(0xc20801af00, 0x7fd71cdcfc70, 0xc208b950c0, 0x0, 0x0)
/home/ericu/rtb/src/github.com/golang/lint/lint.go:231 +0x74
github.com/golang/lint.func·007(0x7fd71caf7838, 0xc208b8e870, 0xc208b8b501)
/home/ericu/rtb/src/github.com/golang/lint/lint.go:827 +0x5c2
github.com/golang/lint.walker.Visit(0xc208ce67a0, 0x7fd71caf7838, 0xc208b8e870, 0x0, 0x0)
/home/ericu/rtb/src/github.com/golang/lint/lint.go:1185 +0x48
go/ast.Walk(0x7fd71caf7750, 0xc208ce67a0, 0x7fd71caf7838, 0xc208b8e870)
/home/ericu/builds/go/src/pkg/go/ast/walk.go:52 +0x58
go/ast.Walk(0x7fd71caf7750, 0xc208ce67a0, 0x7fd71caf77a8, 0xc208b92c80)
/home/ericu/builds/go/src/pkg/go/ast/walk.go:329 +0x21e0
go/ast.walkDeclList(0x7fd71caf7750, 0xc208ce67a0, 0xc2083b0600, 0x13, 0x20)
/home/ericu/builds/go/src/pkg/go/ast/walk.go:38 +0xd1
go/ast.Walk(0x7fd71caf7750, 0xc208ce67a0, 0x7fd71cdf99d0, 0xc208b74c80)
/home/ericu/builds/go/src/pkg/go/ast/walk.go:351 +0x2cb6
github.com/golang/lint.(_file).walk(0xc208ba0140, 0xc208ce67a0)
/home/ericu/rtb/src/github.com/golang/lint/lint.go:1161 +0x82
github.com/golang/lint.(_file).lintVarDecls(0xc208ba0140)
/home/ericu/rtb/src/github.com/golang/lint/lint.go:852 +0x8c
github.com/golang/lint.(_file).lint(0xc208ba0140)
/home/ericu/rtb/src/github.com/golang/lint/lint.go:145 +0x6d
github.com/golang/lint.(_pkg).lint(0xc20801af00, 0x0, 0x0, 0x0)
/home/ericu/rtb/src/github.com/golang/lint/lint.go:122 +0xf0
github.com/golang/lint.(*Linter).LintFiles(0xc208dd5c90, 0xc208026ba0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/ericu/rtb/src/github.com/golang/lint/lint.go:79 +0x3de
main.lintFiles(0xc20800e010, 0x7b, 0x7b)
/home/ericu/rtb/src/github.com/golang/lint/golint/golint.go:76 +0x235
main.main()
/home/ericu/rtb/src/github.com/golang/lint/golint/golint.go:50 +0x183
goroutine 19 [finalizer wait]:
runtime.park(0x4146d0, 0x7dbf90, 0x7daa89)
/home/ericu/builds/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x7dbf90, 0x7daa89)
/home/ericu/builds/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
/home/ericu/builds/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
/home/ericu/builds/go/src/pkg/runtime/proc.c:1445
ericu@ericu-trusty-ubuntu:~/rtb/src/spiceworks.com/rtb$ find . -type f -name '*.go' | wc -l
123

Closing comment (2014-09-15T02:27:55Z): This is a duplicate of #63. It's not the number of files that's the problem, but that the files are in different packages.