From e4dc7aaf386eb8c1c4d7294a18b1303f268180c1 Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Sun, 3 Mar 2024 10:29:32 -0500 Subject: [PATCH] deadcode: quotedList() keysWithColons() --- pkg/credsfile/providerConfig.go | 17 ---------- pkg/credsfile/providerConfig_test.go | 51 ---------------------------- 2 files changed, 68 deletions(-) delete mode 100644 pkg/credsfile/providerConfig_test.go diff --git a/pkg/credsfile/providerConfig.go b/pkg/credsfile/providerConfig.go index 95bfe5836..34c751065 100644 --- a/pkg/credsfile/providerConfig.go +++ b/pkg/credsfile/providerConfig.go @@ -19,23 +19,6 @@ import ( "github.com/google/shlex" ) -func quotedList(l []string) string { - if len(l) == 0 { - return "" - } - return `"` + strings.Join(l, `", "`) + `"` -} - -func keysWithColons(list []string) []string { - var r []string - for _, k := range list { - if strings.Contains(k, ":") { - r = append(r, k) - } - } - return r -} - // LoadProviderConfigs will open or execute the specified file name, and parse its contents. It will replace environment variables it finds if any value matches $[A-Za-z_-0-9]+ func LoadProviderConfigs(fname string) (map[string]map[string]string, error) { var results = map[string]map[string]string{} diff --git a/pkg/credsfile/providerConfig_test.go b/pkg/credsfile/providerConfig_test.go deleted file mode 100644 index 67af7541b..000000000 --- a/pkg/credsfile/providerConfig_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package credsfile - -import ( - "reflect" - "testing" -) - -func Test_keysWithColons(t *testing.T) { - type args struct { - list []string - } - tests := []struct { - name string - args args - want []string - }{ - {"0", args{list: []string{""}}, nil}, - {"1", args{list: []string{"none"}}, nil}, - {"2", args{list: []string{"a:b"}}, []string{"a:b"}}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := keysWithColons(tt.args.list); !reflect.DeepEqual(got, tt.want) { - t.Errorf("keysWithColons() = %v, want %v", got, tt.want) - } - }) - } -} - -func Test_quotedList(t *testing.T) { - type args struct { - l []string - } - tests := []struct { - name string - args args - want string - }{ - {"none", args{}, ""}, - {"single", args{l: []string{"one"}}, `"one"`}, - {"two", args{l: []string{"ricky", "lucy"}}, `"ricky", "lucy"`}, - {"three", args{l: []string{"manny", "moe", "jack"}}, `"manny", "moe", "jack"`}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := quotedList(tt.args.l); got != tt.want { - t.Errorf("quotedList() = %v, want %v", got, tt.want) - } - }) - } -}