cassava/repoctl

repols: runtime error if repo not configured

AladW opened this issue · 3 comments

AladW commented

If the repo variable is not set in ~/.config/repoctl/config.toml, or the file is not available, repols (from the devel branch) gives a runtime error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x4025a0]

goroutine 1 [running]:
panic(0x846ea0, 0xc82000a130)
        /usr/lib/go/src/runtime/panic.go:481 +0x3e6
main.main()
        /home/archie/go/src/github.com/cassava/repoctl/cmd/repols/main.go:27 +0xb10

In 0.15, a warning message was displayed instead:

Error: repository path must be set in configuration.

Thanks for catching this!

Although I'm kinda wondering if I should have repols not give error messages at all, as it is used in the Zsh completion script.

AladW commented

You could add an 2>/dev/null in the completion script, at least if this is the only context where having error messages makes no sense.