Describe the bug
After installing the package of snap, you cannot use the binary program compiled by yourself to operate the/etc/hosts file. Even if you uninstall the package of snap, it will not return to normal
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
$ hostctl list
+---------+--------+-----------+-----------------+
| PROFILE | STATUS | IP | DOMAIN |
+---------+--------+-----------+-----------------+
| default | on | 127.0.0.1 | localhost |
| default | on | 127.0.1.1 | pc1 |
| default | on | ::1 | ip6-localhost |
| default | on | fe00:: | ip6-localnet |
| default | on | ff00:: | ip6-mcastprefix |
| default | on | ff02::1 | ip6-allnodes |
| default | on | ff02::2 | ip6-allrouters |
+---------+--------+-----------+-----------------+
$ ./hostctl list
panic: runtime error: index out of range [1] with length 0
goroutine 1 [running]:
github.com/guumaster/hostctl/pkg/parser.parseRouteLine({0xbc68c0?, 0x8?})
/mnt/001/project/dns/hostctl/pkg/parser/parser.go:146 +0x252
github.com/guumaster/hostctl/pkg/parser.parseToDefault({0xc0005ca024, 0x1, 0xfdc}, {0x0?, 0x3?})
/mnt/001/project/dns/hostctl/pkg/parser/parser.go:102 +0x6e
github.com/guumaster/hostctl/pkg/parser.Parse({0x959a00, 0xc00059e060})
/mnt/001/project/dns/hostctl/pkg/parser/parser.go:67 +0x48a
github.com/guumaster/hostctl/pkg/file.NewWithFs({0x89bf75?, 0x89b749?}, {0x95edc0?, 0xc2e880?})
/mnt/001/project/dns/hostctl/pkg/file/file.go:44 +0x112
github.com/guumaster/hostctl/pkg/file.NewFile(...)
/mnt/001/project/dns/hostctl/pkg/file/file.go:27
github.com/guumaster/hostctl/cmd/hostctl/actions.newListCmd.func1(0xc0005ae000?, {0xc2e880, 0x0, 0x0})
/mnt/001/project/dns/hostctl/cmd/hostctl/actions/list.go:25 +0x5f
github.com/spf13/cobra.(*Command).execute(0xc0005ae000, {0xc2e880, 0x0, 0x0})
/root/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:872 +0x694
github.com/spf13/cobra.(*Command).ExecuteC(0xc00047b400)
/root/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:990 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
/root/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:918
main.main()
/mnt/001/project/dns/hostctl/cmd/hostctl/main.go:20 +0x76
System (please complete the following information):
OS: ubuntu
Version: 22.04TLS
Additional context
Add any other context about the problem here.
Describe the bug After installing the package of snap, you cannot use the binary program compiled by yourself to operate the/etc/hosts file. Even if you uninstall the package of snap, it will not return to normal
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Screenshots
System (please complete the following information):
Additional context Add any other context about the problem here.