diff options
author | Martin Polden <mpolden@mpolden.no> | 2022-04-08 15:22:20 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2022-04-11 08:56:04 +0200 |
commit | 417ac134b9ea21772bb4986779eedbd64ea5f8a5 (patch) | |
tree | d65ed1715718dcb959c649a491b6e9feb7c40ace /client/go/cmd/config_test.go | |
parent | 574fccecfc2e47f7326005a11783f9a2562e16d7 (diff) |
Remove viper
Cobra no longer depends on Viper since 1.4.0. By implementing our own config
instead, we can get rid of Viper altogether and remove some hacks made necessary
by that library.
Bonus: Removes the large dependency tree pulled in by Viper, reducing the binary
size by ~1 MB.
Diffstat (limited to 'client/go/cmd/config_test.go')
-rw-r--r-- | client/go/cmd/config_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/client/go/cmd/config_test.go b/client/go/cmd/config_test.go index 58e70893619..673d90506f8 100644 --- a/client/go/cmd/config_test.go +++ b/client/go/cmd/config_test.go @@ -43,6 +43,14 @@ func TestConfig(t *testing.T) { assertConfigCommand(t, configHome, "", "config", "set", "application", "t1.a1") assertConfigCommand(t, configHome, "application = t1.a1.default\n", "config", "get", "application") + + // Write empty value, which should be ignored. This is for compatibility with older config formats + configFile := filepath.Join(configHome, "config.yaml") + data, err := os.ReadFile(configFile) + require.Nil(t, err) + config := string(data) + "zone: \"\"\n" + require.Nil(t, os.WriteFile(configFile, []byte(config), 0600)) + assertConfigCommand(t, configHome, "zone = <unset>\n", "config", "get", "zone") } func TestLocalConfig(t *testing.T) { |