Skip to content

Commit db7d0dc

Browse files
Fixes gosec errors (zalando#1665)
* Fixes `_test_plugins` type redeclation * Excludes `G402` `gosec` due to securego/gosec#551 and securego/gosec#528 Signed-off-by: Alexander Yastrebov <[email protected]>
1 parent 7a390bd commit db7d0dc

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ staticcheck: $(SOURCES)
145145
# G101 find by variable name match "oauth" are not hardcoded credentials
146146
# G104 ignoring errors are in few cases fine
147147
# G304 reading kubernetes secret filepaths are not a file inclusions
148+
# G402 See https://github.com/securego/gosec/issues/551 and https://github.com/securego/gosec/issues/528
148149
gosec: $(SOURCES)
149-
GO111MODULE=$(GO111) .bin/gosec -quiet -exclude="G101,G104,G304" ./...
150+
GO111MODULE=$(GO111) .bin/gosec -quiet -exclude="G101,G104,G304,G402" ./...
150151

151152
fmt: $(SOURCES)
152153
@gofmt -w -s $(SOURCES)

_test_plugins/multitype_noop.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ import (
77
"github.com/zalando/skipper/routing"
88
)
99

10-
type noopSpec struct {
10+
type multiSpec struct {
1111
Type string
1212
}
1313

1414
func InitPlugin(opts []string) ([]filters.Spec, []routing.PredicateSpec, []routing.DataClient, error) {
15-
return []filters.Spec{noopSpec{"noop"}}, []routing.PredicateSpec{noopSpec{"None"}}, nil, nil
15+
return []filters.Spec{multiSpec{"noop"}}, []routing.PredicateSpec{multiSpec{"None"}}, nil, nil
1616
}
1717

18-
func (s noopSpec) Name() string {
18+
func (s multiSpec) Name() string {
1919
return s.Type
2020
}
2121

22-
func (s noopSpec) CreateFilter(config []interface{}) (filters.Filter, error) {
22+
func (s multiSpec) CreateFilter(config []interface{}) (filters.Filter, error) {
2323
return noop{}, nil
2424
}
2525

26-
func (s noopSpec) Create(config []interface{}) (routing.Predicate, error) {
26+
func (s multiSpec) Create(config []interface{}) (routing.Predicate, error) {
2727
return noop{}, nil
2828
}
2929

0 commit comments

Comments
 (0)