kwatch
kwatch copied to clipboard
kwatch with no config.yaml present panics after warning about config.yaml file not found
Describe the bug
With kwatch
v0.6.1
built using go1.18.4
, running kwatch
with no config.yaml
in present directory, the kwatch
application panics after issuing WARN
about the missing config file:
$ ./kwatch
INFO[0000] :tada: kwatch@dev just started!
WARN[0000] unable to load config file: open config.yaml: no such file or directory
panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine 1 [running]:
github.com/abahmed/kwatch/util.GetProviders()
/home/abuild/rpmbuild/BUILD/kwatch-0.6.1/util/util.go:121 +0x1316
main.main()
/home/abuild/rpmbuild/BUILD/kwatch-0.6.1/main.go:36 +0x1f3
$ ./kwatch --help
INFO[0000] :tada: kwatch@dev just started!
WARN[0000] unable to load config file: open config.yaml: no such file or directory
panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine 1 [running]:
github.com/abahmed/kwatch/util.GetProviders()
/home/abuild/rpmbuild/BUILD/kwatch-0.6.1/util/util.go:121 +0x1316
main.main()
/home/abuild/rpmbuild/BUILD/kwatch-0.6.1/main.go:36 +0x1f3
To Reproduce
Build kwatch
v0.6.1
built using go1.18.4
. Execute kwatch
binary in a directory with no config.yaml
and none present in locations expected by kwatch
Expected behavior
Warning that a config file is needed (this is the case currently) followed by instructions on how to create a valid minimal one.
Better yet would be if kwatch
had defaults (even if empty / no-op) and only required a config file be present for operations that connect to a Kubernetes instance. E.g. kwatch --help
should execute with no configuration file found.
Actual behavior
Warning (expected) followed by panic (unexpected).
Version/Commit
kwatch
v0.6.1
built using go1.18.4
.