codegangsta / gin

Live reload utility for Go web servers
MIT License
4.23k stars 317 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #132

Open ArniXXX opened 6 years ago

ArniXXX commented 6 years ago

uname -v

35~16.04.1-Ubuntu SMP Thu Jan 25 10:13:43 UTC 2018

gin run app.go [gin] Listening on port 3000 [gin] Building... panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x68c0d6]

goroutine 1 [running]: syscall.syscall.WaitStatus.ExitStatus(...) /usr/local/go/src/os/exec_posix.go:73 os.(ProcessState).os.success(...) /usr/local/go/src/os/exec_posix.go:73 os.(ProcessState).Success(...) /usr/local/go/src/os/exec.go:142 github.com/codegangsta/gin/lib.(builder).Build(0xc42006a2a0, 0xc42005d360, 0x1) /home/taras/go/src/github.com/codegangsta/gin/lib/builder.go:62 +0x316 main.build(0x968c60, 0xc42006a2a0, 0x9699e0, 0xc42006a300, 0xc420088280) /home/taras/go/src/github.com/codegangsta/gin/main.go:234 +0xc1 main.MainAction(0xc4200bc840) /home/taras/go/src/github.com/codegangsta/gin/main.go:203 +0xa9c gopkg.in/urfave/cli%2ev1.HandleAction(0x732fa0, 0x7cb500, 0xc4200bc840, 0xc42006a200, 0x0) /home/taras/go/src/gopkg.in/urfave/cli.v1/app.go:492 +0x7c gopkg.in/urfave/cli%2ev1.Command.Run(0x7b48ed, 0x3, 0x7b465f, 0x1, 0x0, 0x0, 0x0, 0x7c3c58, 0x32, 0x0, ...) /home/taras/go/src/gopkg.in/urfave/cli.v1/command.go:210 +0xa95 gopkg.in/urfave/cli%2ev1.(App).Run(0xc4200849c0, 0xc420010090, 0x3, 0x3, 0x0, 0x0) /home/taras/go/src/gopkg.in/urfave/cli.v1/app.go:255 +0x6f8 main.main() /home/taras/go/src/github.com/codegangsta/gin/main.go:140 +0xdc8

lokhman commented 6 years ago

I have exactly the same problem.

karlkeefer commented 6 years ago

I'm getting a similar stacktrace, mine only shows up when using the --godep arg though.

ear commented 5 years ago

I think this just happened to me as well.

I had it running and reloading an app just fine: I then ran rm <file> on a non-go non-relevant file in the same directory as the one watched for changes and this happened:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x12f48cc]

goroutine 1 [running]:
main.scanChanges.func1(0xc4202e98c0, 0x1c, 0x0, 0x0, 0x1525940, 0xc42034e2a0, 0x0, 0x0)
    go/src/github.com/codegangsta/gin/main.go:256 +0xfc
path/filepath.walk(0x7fff5fbff7c7, 0x1, 0x152c300, 0xc42050dba0, 0xc4204f9530, 0x0, 0x30)
    /usr/local/Cellar/go/1.8.3/libexec/src/path/filepath/path.go:372 +0x2fe
path/filepath.Walk(0x7fff5fbff7c7, 0x1, 0xc4204f9530, 0x0, 0x0)
    /usr/local/Cellar/go/1.8.3/libexec/src/path/filepath/path.go:398 +0x14c
main.scanChanges(0x7fff5fbff7c7, 0x1, 0xc420071470, 0x1, 0x1, 0x1, 0xc42001a0f0)
    go/src/github.com/codegangsta/gin/main.go:263 +0xb1
main.MainAction(0xc42008c840)
    go/src/github.com/codegangsta/gin/main.go:199 +0xba7
gopkg.in/urfave/cli%2ev1.HandleAction(0x132b300, 0x13bbd18, 0xc42008c840, 0xc42006e400, 0x0)
    go/src/gopkg.in/urfave/cli.v1/app.go:492 +0x7c
gopkg.in/urfave/cli%2ev1.Command.Run(0x13a8163, 0x3, 0x13a7e9e, 0x1, 0x0, 0x0, 0x0, 0x13b7b2a, 0x32, 0x0, ...)
    go/src/gopkg.in/urfave/cli.v1/command.go:210 +0xb6e
gopkg.in/urfave/cli%2ev1.(*App).Run(0xc42005b040, 0xc420078410, 0xd, 0xd, 0x0, 0x0)
    go/src/gopkg.in/urfave/cli.v1/app.go:255 +0x76f
main.main()
    go/src/github.com/codegangsta/gin/main.go:131 +0xd0d
karlkeefer commented 5 years ago

@ear I ended up using modd

It has an example config in the README specific to go projects. It runs relevant tests on file change, and still does the daemonization / auto-rebuild stuff that gin does.