From db7d0dc2cff9c81b574caa92c42340505b3bbe80 Mon Sep 17 00:00:00 2001 From: Alexander Yastrebov Date: Mon, 4 Jan 2021 17:47:21 +0100 Subject: [PATCH] Fixes gosec errors (#1665) * Fixes `_test_plugins` type redeclation * Excludes `G402` `gosec` due to https://github.com/securego/gosec/issues/551 and https://github.com/securego/gosec/issues/528 Signed-off-by: Alexander Yastrebov --- Makefile | 3 ++- _test_plugins/multitype_noop.go | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 277cba8867..3897bd8c7f 100644 --- a/Makefile +++ b/Makefile @@ -145,8 +145,9 @@ staticcheck: $(SOURCES) # G101 find by variable name match "oauth" are not hardcoded credentials # G104 ignoring errors are in few cases fine # G304 reading kubernetes secret filepaths are not a file inclusions +# G402 See https://github.com/securego/gosec/issues/551 and https://github.com/securego/gosec/issues/528 gosec: $(SOURCES) - GO111MODULE=$(GO111) .bin/gosec -quiet -exclude="G101,G104,G304" ./... + GO111MODULE=$(GO111) .bin/gosec -quiet -exclude="G101,G104,G304,G402" ./... fmt: $(SOURCES) @gofmt -w -s $(SOURCES) diff --git a/_test_plugins/multitype_noop.go b/_test_plugins/multitype_noop.go index 96f1202eeb..cd12add3e9 100644 --- a/_test_plugins/multitype_noop.go +++ b/_test_plugins/multitype_noop.go @@ -7,23 +7,23 @@ import ( "github.com/zalando/skipper/routing" ) -type noopSpec struct { +type multiSpec struct { Type string } func InitPlugin(opts []string) ([]filters.Spec, []routing.PredicateSpec, []routing.DataClient, error) { - return []filters.Spec{noopSpec{"noop"}}, []routing.PredicateSpec{noopSpec{"None"}}, nil, nil + return []filters.Spec{multiSpec{"noop"}}, []routing.PredicateSpec{multiSpec{"None"}}, nil, nil } -func (s noopSpec) Name() string { +func (s multiSpec) Name() string { return s.Type } -func (s noopSpec) CreateFilter(config []interface{}) (filters.Filter, error) { +func (s multiSpec) CreateFilter(config []interface{}) (filters.Filter, error) { return noop{}, nil } -func (s noopSpec) Create(config []interface{}) (routing.Predicate, error) { +func (s multiSpec) Create(config []interface{}) (routing.Predicate, error) { return noop{}, nil }