Skip to content

Commit

Permalink
linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jayjanssen committed Jun 26, 2024
1 parent 3cfcac0 commit b98904f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/dbconn/metadatalock.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dbconn

import (
"context"
"errors"
"fmt"
"time"

Expand All @@ -23,7 +24,7 @@ type MetadataLock struct {

func NewMetadataLock(ctx context.Context, dsn string, lockName string, logger loggers.Advanced) (*MetadataLock, error) {
if len(lockName) == 0 {
return nil, fmt.Errorf("metadata lock name is empty")
return nil, errors.New("metadata lock name is empty")
}
if len(lockName) > 64 {
return nil, fmt.Errorf("metadata lock name is too long: %d, max length is 64", len(lockName))
Expand All @@ -47,7 +48,6 @@ func NewMetadataLock(ctx context.Context, dsn string, lockName string, logger lo
var answer int
if err := dbConn.QueryRowContext(ctx, "SELECT GET_LOCK(?, ?)", lockName, getLockTimeout.Seconds()).Scan(&answer); err != nil {
return fmt.Errorf("could not acquire metadata lock: %s", err)

}
if answer == 0 {
// 0 means the lock is held by another connection
Expand Down
1 change: 0 additions & 1 deletion pkg/dbconn/metadatalock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func TestMetadataLock(t *testing.T) {
mdl3, err := NewMetadataLock(context.Background(), testutils.DSN(), lockName, logger)
assert.NoError(t, err)
assert.NoError(t, mdl3.Close())

}

func TestMetadataLockContextCancel(t *testing.T) {
Expand Down

0 comments on commit b98904f

Please sign in to comment.