Skip to content

Commit

Permalink
chore: remove unused logger
Browse files Browse the repository at this point in the history
  • Loading branch information
marcsauter committed Apr 15, 2024
1 parent 8bc79b5 commit ed8e6bb
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 45 deletions.
6 changes: 2 additions & 4 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
Expand All @@ -70,16 +68,16 @@ linters:
- misspell
- nakedret
- prealloc
- protogetter
- rowserrcheck
- exportloopref
- staticcheck
- structcheck
- stylecheck
- sqlclosecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
- wsl

Expand Down
16 changes: 6 additions & 10 deletions fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (

"github.com/postfinance/secfs/internal/backend"
"github.com/spf13/afero"
"go.uber.org/zap"
"k8s.io/client-go/kubernetes"
)

Expand All @@ -36,7 +35,6 @@ type secfs struct {
suffix string
labels map[string]string
timeout time.Duration
l *zap.SugaredLogger
}

var _ afero.Fs = (*secfs)(nil) // https://pkg.go.dev/github.com/spf13/afero#Fs
Expand All @@ -48,7 +46,6 @@ func New(k kubernetes.Interface, opts ...Option) afero.Fs {
prefix: DefaultSecretPrefix,
suffix: DefaultSecretSuffix,
timeout: DefaultRequestTimeout,
l: zap.NewNop().Sugar(),
}

for _, option := range opts {
Expand All @@ -60,7 +57,6 @@ func New(k kubernetes.Interface, opts ...Option) afero.Fs {
backend.WithSecretSuffix(s.suffix),
backend.WithSecretLabels(s.labels),
backend.WithTimeout(s.timeout),
backend.WithLogger(s.l),
)

return s
Expand All @@ -80,7 +76,7 @@ func (sfs secfs) Create(name string) (afero.File, error) {

// Mkdir creates a new, empty secret
// return an error if any happens.
func (sfs secfs) Mkdir(name string, perm os.FileMode) error {
func (sfs secfs) Mkdir(name string, _ os.FileMode) error {
s, err := newFile(name)
if err != nil {
return wrapPathError("Mkdir", name, err)
Expand Down Expand Up @@ -123,8 +119,8 @@ func (sfs secfs) Open(name string) (afero.File, error) {
// https://pkg.go.dev/os#OpenFile
// perm will be ignored because there is nothing comparable to filesystem permission for Kubernetes secrets
//
//nolint:gocognit,gocyclo // complex function
func (sfs secfs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error) {
//nolint:gocyclo // complex function
func (sfs secfs) OpenFile(name string, flag int, _ os.FileMode) (afero.File, error) {
s, err := newFile(name)
if err != nil {
return nil, wrapPathError("OpenFile", name, err)
Expand Down Expand Up @@ -294,16 +290,16 @@ func (sfs secfs) Stat(name string) (os.FileInfo, error) {
}

// Chmod changes the mode of the named file to mode.
func (sfs secfs) Chmod(name string, mode os.FileMode) error {
func (sfs secfs) Chmod(_ string, _ os.FileMode) error {
return nil
}

// Chown changes the uid and gid of the named file.
func (sfs secfs) Chown(name string, uid, gid int) error {
func (sfs secfs) Chown(_ string, _, _ int) error {
return nil
}

// Chtimes changes the access and modification times of the named file
func (sfs secfs) Chtimes(name string, atime, mtime time.Time) error {
func (sfs secfs) Chtimes(_ string, _, _ time.Time) error {
return nil
}
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.20
require (
github.com/spf13/afero v1.9.5
github.com/stretchr/testify v1.8.2
go.uber.org/zap v1.24.0
golang.org/x/net v0.8.0
k8s.io/api v0.26.2
k8s.io/apimachinery v0.26.2
Expand Down Expand Up @@ -35,8 +34,6 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
Expand Down
8 changes: 0 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
Expand Down Expand Up @@ -213,13 +212,6 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down
2 changes: 0 additions & 2 deletions internal/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"syscall"
"time"

"go.uber.org/zap"
"golang.org/x/net/context"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -74,7 +73,6 @@ type backend struct {

mu sync.Mutex
timeout time.Duration
l *zap.SugaredLogger
}

// New returns a Backend
Expand Down
9 changes: 0 additions & 9 deletions internal/backend/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package backend

import (
"time"

"go.uber.org/zap"
)

// Option represents a functional Option
Expand Down Expand Up @@ -53,10 +51,3 @@ func WithSecretLabels(labels map[string]string) Option {
b.labels = labels
}
}

// WithLogger configures a logger
func WithLogger(l *zap.SugaredLogger) Option {
return func(b *backend) {
b.l = l
}
}
9 changes: 0 additions & 9 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package secfs

import (
"time"

"go.uber.org/zap"
)

// Option represents a functional Option
Expand Down Expand Up @@ -36,10 +34,3 @@ func WithTimeout(t time.Duration) Option {
s.timeout = t
}
}

// WithLogger configures a logger
func WithLogger(l *zap.SugaredLogger) Option {
return func(s *secfs) {
s.l = l
}
}

0 comments on commit ed8e6bb

Please sign in to comment.