Skip to content

bodyclose: panic #733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stevenh opened this issue Sep 24, 2019 · 7 comments · Fixed by golangci/bodyclose#1
Closed

bodyclose: panic #733

stevenh opened this issue Sep 24, 2019 · 7 comments · Fixed by golangci/bodyclose#1
Labels
bug Something isn't working

Comments

@stevenh
Copy link

stevenh commented Sep 24, 2019

When running golangci-lint run with bodyclose enable it panics

golangci-lint --version
golangci-lint has version 1.19.0 built from 27ac4c7 on 2019-09-23T20:40:18Z
go version && go env
go version go1.13 freebsd/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN="/data/go/bin"
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GONOPROXY=""
GONOSUMDB=""
GOOS="freebsd"
GOPATH="/data/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/freebsd_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build849839756=/tmp/go-build -gno-record-gcc-switches"
WARN [linters context] Panic: bodyclose: package "phttp" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 47307 [running]:
runtime/debug.Stack(0xf57075, 0x3c, 0xc00167d8b8)
        /usr/local/go/src/runtime/debug/stack.go:24 +0x9d
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1(0xc034cff740)
        /Users/denis/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:404 +0x1af
panic(0xd9a0e0, 0x1720290)
        /usr/local/go/src/runtime/panic.go:679 +0x1b2
go/types.(*object).Name(...)
        /usr/local/go/src/go/types/object.go:133
github.com/timakin/bodyclose/passes/bodyclose.(*runner).calledInFunc(0xc00167dc78, 0xc0b624d7c0, 0xc0b6512800, 0x10ae3a0)
        /Users/denis/go/src/github.com/golangci/golangci-lint/vendor/github.com/timakin/bodyclose/passes/bodyclose/bodyclose.go:328 +0x284
github.com/timakin/bodyclose/passes/bodyclose.(*runner).isopen(0xc00167dc78, 0xc0b6476580, 0x14, 0x0)
        /Users/denis/go/src/github.com/golangci/golangci-lint/vendor/github.com/timakin/bodyclose/passes/bodyclose/bodyclose.go:148 +0x555
github.com/timakin/bodyclose/passes/bodyclose.runner.run(0xc0a41bfc20, 0x10b9cc0, 0xc020a70910, 0xc0b6fc58e0, 0x10b9d60, 0xc020aea690, 0xc003d10c80, 0xc0b6f71a10, 0xc0a41bfc20, 0xe41140933e432942, ...)
        /Users/denis/go/src/github.com/golangci/golangci-lint/vendor/github.com/timakin/bodyclose/passes/bodyclose/bodyclose.go:102 +0x589
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc034cff740)
        /Users/denis/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:495 +0x87a
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc034cff740)
        /Users/denis/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:407 +0x5b
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func3(0xc09f24a800, 0xc034cff740)
        /Users/denis/go/src/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go:961 +0x69
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
        /Users/denis/go/src/github.com/golangci/golangci-lint/pkg/g
stevenh added a commit to stevenh/bodyclose that referenced this issue Sep 24, 2019
Fix a panic caused by using a nil Call.Method.

Fixes golangci/golangci-lint#733
@ldez
Copy link
Member

ldez commented Sep 24, 2019

I created a fix timakin/bodyclose#22

@stevenh
Copy link
Author

stevenh commented Sep 24, 2019

hehe same fix as I did too golangci/bodyclose#1 ;-)

@ldez
Copy link
Member

ldez commented Sep 24, 2019

I chose to create my PR on the upstream, because I still have hope 😄

@jirfag
Copy link
Contributor

jirfag commented Sep 24, 2019

hi, I've merged golangci/bodyclose#1.

@jirfag jirfag closed this as completed in a2b2c7a Sep 24, 2019
@jirfag
Copy link
Contributor

jirfag commented Sep 24, 2019

And I've updated bodyclose in the master branch

@tpounds tpounds added the bug Something isn't working label Sep 25, 2019
@timakin
Copy link

timakin commented Sep 26, 2019

So sorry to catch up with this issue, and thanks @jirfag and @ldez.
I merged your bugfix into bodyclose 's original master branch.

@tpounds
Copy link
Contributor

tpounds commented Sep 26, 2019

@timakin Thanks! I've added a pr to update to the latest version here #751.

korjavin added a commit to korjavin/golangci-lint-1 that referenced this issue Sep 28, 2019
* tag 'v1.19.1':
  Use separate go.mod/go.sum to manage tool deps. (golangci#736)
  Use stretchr/testify to mock log.
  Fix golangci#733: update forked bodyclose
  Cleanup obsolete go.mod/go.sum diff. (golangci#729)
  dev: update deprecated parts of .goreleaser.yml
  dev: trigger CI build on tag push
  Update minimum Go version to 1.12.
  Enable consistent GOPROXY Go 1.12/1.13 behavior.
  Fix golangci#608: use forked bodyclose
  Drop memory usage of go/analysis linters 5x
  Manage build tools via go.mod.
  Update whitespace
  Reduce memory usage of go/analysis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants