Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
maraino committed Jul 7, 2022
1 parent 30ef454 commit 5ed32bd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
6 changes: 3 additions & 3 deletions kms/kmfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type kmsfs struct {
apiv1.KeyManager
}

func new(ctx context.Context, kmsuri string) (*kmsfs, error) {
func newFS(ctx context.Context, kmsuri string) (*kmsfs, error) {
if kmsuri == "" {
return &kmsfs{}, nil
}
Expand Down Expand Up @@ -52,7 +52,7 @@ type certFS struct {

// CertFS creates a new io/fs with the given KMS URI.
func CertFS(ctx context.Context, kmsuri string) (fs.FS, error) {
km, err := new(ctx, kmsuri)
km, err := newFS(ctx, kmsuri)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -88,7 +88,7 @@ type keyFS struct {

// KeyFS creates a new KeyFS with the given KMS URI.
func KeyFS(ctx context.Context, kmsuri string) (fs.FS, error) {
km, err := new(ctx, kmsuri)
km, err := newFS(ctx, kmsuri)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion kms/kmfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func Test_new(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := new(tt.args.ctx, tt.args.kmsuri)
got, err := newFS(tt.args.ctx, tt.args.kmsuri)
if (err != nil) != tt.wantErr {
t.Errorf("new() error = %v, wantErr %v", err, tt.wantErr)
return
Expand Down
12 changes: 6 additions & 6 deletions kms/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ func (o *object) Read(b []byte) (int, error) {
return o.pemData.Read(b)
}

func (p *object) Close() error {
p.Object = nil
p.pemData = nil
if p.err == nil {
p.err = io.EOF
func (o *object) Close() error {
o.Object = nil
o.pemData = nil
if o.err == nil {
o.err = io.EOF
return nil
}
return p.err
return o.err
}
7 changes: 0 additions & 7 deletions kms/object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,6 @@ func Test_object_Close(t *testing.T) {
t.Fatal(err)
}

type fields struct {
Path string
Object interface{}
once sync.Once
err error
pemData *bytes.Buffer
}
tests := []struct {
name string
o *object
Expand Down

0 comments on commit 5ed32bd

Please sign in to comment.