• Hitoshi Mitake's avatar
    restore: handle a case of empty GOPATH · c98cb3f1
    Hitoshi Mitake authored
    When godep restore is executed with empty GOPATH, it fails with error
    message like below:
    $ godep restore
    panic: runtime error: index out of range
    
    goroutine 1 [running]:
    main.download(0xc82012a000, 0x0, 0x0)
            /home/mitake/gopath/src/github.com/tools/godep/restore.go:104 +0x1cb8
    main.runRestore(0xaffe00, 0xc82000a390, 0x0, 0x0)
            /home/mitake/gopath/src/github.com/tools/godep/restore.go:42 +0x3a5
    main.main()
            /home/mitake/gopath/src/github.com/tools/godep/main.go:118 +0xd9f
    
    goroutine 17 [syscall, locked to thread]:
    runtime.goexit()
            /usr/local/go/src/runtime/asm_amd64.s:1696 +0x1
    
    This commit lets the command handle such a case with a little bit
    grace error message like this:
    $ godep restore
    godep: Error restore requires GOPATH but it is empty.
    c98cb3f1