I want to put my app in production but I am having trouble understanding this error log that I am getting while trying to do revel build app
This is part of log:
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x40c485]
goroutine 1 [running]:
main.func·002()
/home/johnny/data/go/src/github.com/revel/cmd/revel/rev.go:71 +0x7e
main.func·003(0xc208a4a400, 0x1001, 0x0, 0x0, 0x7ff4863a9238, 0xc2081ee420, 0x0, 0x0)
/home/johnny/data/go/src/github.com/revel/cmd/revel/util.go:96 +0x2b5
path/filepath.walk(0xc208617000, 0xff1, 0x7ff4863a9260, 0xc20883cff0, 0xc2085799c8, 0x0, 0x0)
/usr/lib/go/src/path/filepath/path.go:368 +0x430
Other lines in log always reffer to this /usr/lib/go/src/path/filepath/path.go
and at the end of log is this:
goroutine 5 [syscall]:
os/signal.loop()
/usr/lib/go/src/os/signal/signal_unix.go:21 +0x1f
created by os/signal.init·1
/usr/lib/go/src/os/signal/signal_unix.go:27 +0x35
This log reminds me of objective C and I know how is hard to debug that.
Maybe I am missing something in routes somewhere? I have some files in .gitignore (i am not sure if that has to do something with a crash?)
You probably need to get familiar with Go stack traces. Here is nice tutorial: http://www.goinggo.net/2015/01/stack-traces-in-go.html
Basically, you have to look for the goroutine in the [running]
state (it usually on the very top of the stack trace) and find out line, which triggered panic.
In this example, github.com/revel/cmd/revel/util.go:96
looks like this:
if info.IsDir() {
err := os.MkdirAll(path.Join(destDir, relSrcPath), 0777)
if !os.IsExist(err) {
panicOnError(err, "Failed to create directory")
}
return nil
}
Panic says panic: runtime error: invalid memory address or nil pointer dereference
, so it must be info
to be nil
(you can see it also as 0x0 in the call to path/filepath.Walk.
Looks like revel bug, not sure without full code/env information.