fix staticchecks

This commit is contained in:
A.Unger
2020-10-07 14:51:14 +02:00
committed by Ilja Neumann
parent 1ff74d1f73
commit 9d285e2ec5
5 changed files with 3 additions and 21 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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()
}