From 9d285e2ec55338587d8e04b61c0455b46f1d151a Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Wed, 7 Oct 2020 14:51:14 +0200 Subject: [PATCH] fix staticchecks --- accounts/pkg/indexer/index/disk/non_unique_test.go | 2 +- accounts/pkg/indexer/index/disk/unique.go | 2 +- accounts/pkg/indexer/index/disk/unique_test.go | 2 +- accounts/pkg/indexer/option/option.go | 11 ----------- accounts/pkg/indexer/test/helpers.go | 7 ------- 5 files changed, 3 insertions(+), 21 deletions(-) diff --git a/accounts/pkg/indexer/index/disk/non_unique_test.go b/accounts/pkg/indexer/index/disk/non_unique_test.go index 000a49055c..1796ed1b7b 100644 --- a/accounts/pkg/indexer/index/disk/non_unique_test.go +++ b/accounts/pkg/indexer/index/disk/non_unique_test.go @@ -69,7 +69,7 @@ func TestNonUniqueIndexSearch(t *testing.T) { assert.Equal(t, "goefe-789", path.Base(res[0])) assert.Equal(t, "xadaf-189", path.Base(res[1])) - res, err = sut.Search("does-not-exist@example.com") + _, err = sut.Search("does-not-exist@example.com") assert.Error(t, err) assert.IsType(t, &errors.NotFoundErr{}, err) diff --git a/accounts/pkg/indexer/index/disk/unique.go b/accounts/pkg/indexer/index/disk/unique.go index 1168ae1e18..07a403bd98 100644 --- a/accounts/pkg/indexer/index/disk/unique.go +++ b/accounts/pkg/indexer/index/disk/unique.go @@ -159,7 +159,7 @@ func (idx Unique) Search(pattern string) ([]string, error) { return nil, &idxerrs.NotFoundErr{TypeName: idx.typeName, Key: idx.indexBy, Value: pattern} } - res := make([]string, 0, 0) + res := make([]string, 0) for _, p := range paths { if err := isValidSymlink(p); err != nil { return nil, err diff --git a/accounts/pkg/indexer/index/disk/unique_test.go b/accounts/pkg/indexer/index/disk/unique_test.go index 87be198213..dcec9217da 100644 --- a/accounts/pkg/indexer/index/disk/unique_test.go +++ b/accounts/pkg/indexer/index/disk/unique_test.go @@ -86,7 +86,7 @@ func TestUniqueIndexSearch(t *testing.T) { assert.Equal(t, "ewf4ofk-555", path.Base(res[0])) assert.Equal(t, "rulan54-777", path.Base(res[1])) - res, err = sut.Search("does-not-exist@example.com") + _, err = sut.Search("does-not-exist@example.com") assert.Error(t, err) assert.IsType(t, &errors.NotFoundErr{}, err) diff --git a/accounts/pkg/indexer/option/option.go b/accounts/pkg/indexer/option/option.go index 6ee1b958d7..d3b0cdcba1 100644 --- a/accounts/pkg/indexer/option/option.go +++ b/accounts/pkg/indexer/option/option.go @@ -20,17 +20,6 @@ type Options struct { ProviderAddr string } -// newOptions initializes the available default options. -func newOptions(opts ...Option) Options { - opt := Options{} - - for _, o := range opts { - o(&opt) - } - - return opt -} - func WithJWTSecret(val string) Option { return func(o *Options) { o.JWTSecret = val diff --git a/accounts/pkg/indexer/test/helpers.go b/accounts/pkg/indexer/test/helpers.go index f1b5122c7f..19a1fe8791 100644 --- a/accounts/pkg/indexer/test/helpers.go +++ b/accounts/pkg/indexer/test/helpers.go @@ -43,10 +43,3 @@ func GetTypeFQN(t interface{}) string { typeName = strings.ReplaceAll(typeName, "/", ".") return typeName } - -func valueOf(v interface{}, field string) string { - r := reflect.ValueOf(v) - f := reflect.Indirect(r).FieldByName(field) - - return f.String() -}