-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Milestone
Description
This is for the golang/tools repository, but can't open an issue there.
Running gorename with the diff display option panics when diff returns no data. Because err is not checked (because of the diff return codes) before display, the display part can panic when the diff output is nil.
My run on my local machine gave me a panic:
$ gorename -d -from '"github.com/netflix/rend/common".BAD_FLAGS' -to ErrorBadFlags
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0xa29b1]
goroutine 1 [running]:
golang.org/x/tools/refactor/rename.diff(0xc820898140, 0x46, 0xc823e76000, 0xe6b, 0xeb6, 0x0, 0x0)
/Users/smansfield/gopkg/src/golang.org/x/tools/refactor/rename/rename.go:503 +0x3d1
golang.org/x/tools/refactor/rename.(*renamer).update(0xc823e41740, 0x0, 0x0)
/Users/smansfield/gopkg/src/golang.org/x/tools/refactor/rename/rename.go:459 +0x10f7
golang.org/x/tools/refactor/rename.Main(0x48a700, 0x0, 0x0, 0x7fff5fbffa12, 0x2a, 0x7fff5fbffa41, 0xd, 0x0, 0x0)
/Users/smansfield/gopkg/src/golang.org/x/tools/refactor/rename/rename.go:348 +0x1369
main.main()
/Users/smansfield/gopkg/src/golang.org/x/tools/cmd/gorename/main.go:49 +0x337
return code: 2
I will be submitting a small patch to prevent this panic and provide some output.