gin icon indicating copy to clipboard operation
gin copied to clipboard

gin fails horribly when go can't be found in $PATH

Open atomicstack opened this issue 10 years ago • 0 comments

Might be worth checking whether there's a go binary in $PATH on startup. When setting up a new install recently, I encountered the following immense stacktrace when using a terminal with a misconfigured environment, where gin was in $PATH, but go wasn't:

matt@o:~/go/src/github.com/dgryski/carbonzipper$ gin -- -d=1 -c /etc/carbonzipper.conf -stdout=true
[gin] listening on port 3000
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x8 pc=0x45517e]

goroutine 16 [running]:
runtime.panic(0x6e6bc0, 0x8d70d3)
        /usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
os.(*ProcessState).success(0x0, 0xc20802a230)
        /usr/local/go/src/pkg/os/exec_posix.go:73 +0x1e
os.(*ProcessState).Success(0x0, 0x0)
        /usr/local/go/src/pkg/os/doc.go:72 +0x27
github.com/codegangsta/gin/lib.(*builder).Build(0xc208022c60, 0x0, 0x0)
        /home/matt/go/src/github.com/codegangsta/gin/lib/builder.go:51 +0x159
main.build(0x7f251429c960, 0xc208022c60, 0x7f251429c998, 0xc2080042a0, 0xc208018640)
        /home/matt/go/src/github.com/codegangsta/gin/main.go:135 +0x36
main.MainAction(0xc20806c180)
        /home/matt/go/src/github.com/codegangsta/gin/main.go:112 +0x70f
github.com/codegangsta/cli.(*App).Run(0xc20806c0c0, 0xc208004060, 0x6, 0x6, 0x0, 0x0)
        /home/matt/go/src/github.com/codegangsta/cli/app.go:135 +0x99c
main.main()
        /home/matt/go/src/github.com/codegangsta/gin/main.go:73 +0x32f

goroutine 19 [finalizer wait]:
runtime.park(0x415340, 0x8dbbb0, 0x8d9e49)
        /usr/local/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x8dbbb0, 0x8d9e49)
        /usr/local/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
        /usr/local/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
        /usr/local/go/src/pkg/runtime/proc.c:1445

goroutine 20 [syscall]:
os/signal.loop()
        /usr/local/go/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.init·1
        /usr/local/go/src/pkg/os/signal/signal_unix.go:27 +0x32

goroutine 21 [runnable]:
net/http.Serve(0x7f251429ca30, 0xc20803a030, 0x7f251429da88, 0xc208000d20, 0x7f251429ca30, 0xc20803a030)
        /usr/local/go/src/pkg/net/http/server.go:1574
created by github.com/codegangsta/gin/lib.(*Proxy).Run
        /home/matt/go/src/github.com/codegangsta/gin/lib/proxy.go:43 +0x25e

goroutine 22 [runnable]:
main.func·003()
        /home/matt/go/src/github.com/codegangsta/gin/main.go:183
created by main.shutdown
        /home/matt/go/src/github.com/codegangsta/gin/main.go:191 +0x15f

matt@o:~/go/src/github.com/dgryski/carbonzipper$ export PATH=$PATH:$HOME/git_tree/go/bin
matt@o:~/go/src/github.com/dgryski/carbonzipper$ which go
/home/matt/git_tree/go/bin/go
matt@o:~/go/src/github.com/dgryski/carbonzipper$ gin -- -d=1 -c /etc/carbonzipper.conf -stdout=true
[gin] listening on port 3000

atomicstack avatar Nov 28 '14 18:11 atomicstack