guumaster / hostctl

Your dev tool to manage /etc/hosts like a pro!

Home Page:http://guumaster.github.io/hostctl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error on enable command

smhmd opened this issue · comments

version: 0.10.0 (I think. Hence #42)

I tried status, toggle, set, and disable, they all work fine, except enable that outputs error on use (still works though).

$ sudo hc enable -p hn --raw
PROFILE STATUS  IP              DOMAIN
hn      on      127.0.0.1       news.ycombinator.com
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5631518b9ac8]

goroutine 1 [running]:
github.com/spf13/cobra.(*Command).Name(0x0, 0xa, 0xc0005adcf8)
        github.com/spf13/cobra@v0.0.7/command.go:1251 +0x28
github.com/guumaster/hostctl/cmd.glob..func11(0xc00011ab00, 0xc0003445d0, 0x0, 0x3, 0x0, 0x563151ad80da, 0x7fff953509de)
        github.com/guumaster/hostctl/cmd/post_action.go:35 +0x1e0
github.com/guumaster/hostctl/cmd.init.3.func3(0xc00011ab00, 0xc0003445d0, 0x0, 0x3, 0x0, 0x0)
        github.com/guumaster/hostctl/cmd/enable.go:50 +0x5e
github.com/spf13/cobra.(*Command).execute(0xc00011ab00, 0xc000344540, 0x3, 0x3, 0xc00011ab00, 0xc000344540)
        github.com/spf13/cobra@v0.0.7/command.go:845 +0x3ef
github.com/spf13/cobra.(*Command).ExecuteC(0x563151f01100, 0x0, 0x0, 0x563100000000)
        github.com/spf13/cobra@v0.0.7/command.go:943 +0x319
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v0.0.7/command.go:883
github.com/guumaster/hostctl/cmd.Execute()
        github.com/guumaster/hostctl/cmd/root.go:42 +0x2f
main.main()
        github.com/guumaster/hostctl/main.go:10 +0x22

Good catch. Fix is coming on next release. Also with --wait for toggle and better docs.

fixed on v0.10.2 👍