From fb0755fb7258c462fa465f351d266afefb8203f0 Mon Sep 17 00:00:00 2001 From: cramja Date: Mon, 21 Jun 2021 17:21:07 -0700 Subject: [PATCH] cleanup --- cmd/namespace/validate_test.go | 12 ++++++------ internal/driver/config/namespace_watcher.go | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cmd/namespace/validate_test.go b/cmd/namespace/validate_test.go index d2a706605..4d21e6d4c 100644 --- a/cmd/namespace/validate_test.go +++ b/cmd/namespace/validate_test.go @@ -65,16 +65,16 @@ func TestValidateConfigNamespaces(t *testing.T) { t.Run("case=supports 3 namespace file formats", func(t *testing.T) { dir := t.TempDir() - files := map[string]string { + nsfiles := map[string]string{ dir + "/ns.yaml": "name: testns0\nid: 0", dir + "/ns.json": "{\"name\": \"testns0\",\"id\": 0}", - dir + "/ns.toml": "name = \"testns0\"\nid = 0", + dir + "/ns.toml": "name = \"testns0\"\nid = 0", } - for fn, contents := range files { + for fn, contents := range nsfiles { require.NoError(t, ioutil.WriteFile(fn, []byte(contents), fileMode)) } - params := append([]string{"validate"}, keys(files)...) + params := append([]string{"validate"}, keys(nsfiles)...) cmd.ExecNoErr(t, params...) }) @@ -143,8 +143,8 @@ func validateCommand() *cobra.Command { func keys(m map[string]string) []string { rv := make([]string, 0, len(m)) - for k, _ := range m { + for k := range m { rv = append(rv, k) } return rv -} \ No newline at end of file +} diff --git a/internal/driver/config/namespace_watcher.go b/internal/driver/config/namespace_watcher.go index e716fcb15..914512936 100644 --- a/internal/driver/config/namespace_watcher.go +++ b/internal/driver/config/namespace_watcher.go @@ -141,6 +141,7 @@ func readNamespaceFile(l *logrusx.Logger, r io.Reader, source string) *Namespace parse, err := GetParser(source) if err != nil { l.WithError(err).WithField("file_name", source).Warn("could not infer format from file extension") + return nil } raw, err := ioutil.ReadAll(r)