Skip to content

Commit a7d5139

Browse files
committed
fix: resolve golangci-lint v2.10.1 issues
Fix gci import ordering (4 files) and staticcheck violations (3 files) surfaced after upgrading golangci-lint from v1.64.8 to v2.10.1. Signed-off-by: Mark Tsai <111229657+shuan1026@users.noreply.github.com>
1 parent 35e68c4 commit a7d5139

File tree

7 files changed

+20
-21
lines changed

7 files changed

+20
-21
lines changed

cmd/bbolt/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,11 +1768,11 @@ Additional options include:
17681768

17691769
type cmdKvStringer struct{}
17701770

1771-
func (_ cmdKvStringer) KeyToString(key []byte) string {
1771+
func (cmdKvStringer) KeyToString(key []byte) string {
17721772
return bytesToAsciiOrHex(key)
17731773
}
17741774

1775-
func (_ cmdKvStringer) ValueToString(value []byte) string {
1775+
func (cmdKvStringer) ValueToString(value []byte) string {
17761776
return bytesToAsciiOrHex(value)
17771777
}
17781778

@@ -1781,7 +1781,7 @@ func CmdKvStringer() bolt.KVStringer {
17811781
}
17821782

17831783
func findLastBucket(tx *bolt.Tx, bucketNames []string) (*bolt.Bucket, error) {
1784-
var lastbucket *bolt.Bucket = tx.Bucket([]byte(bucketNames[0]))
1784+
lastbucket := tx.Bucket([]byte(bucketNames[0]))
17851785
if lastbucket == nil {
17861786
return nil, berrors.ErrBucketNotFound
17871787
}

cmd/bbolt/main_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ import (
1414
"sync"
1515
"testing"
1616

17-
"go.etcd.io/bbolt/internal/btesting"
18-
"go.etcd.io/bbolt/internal/guts_cli"
19-
2017
"github.com/stretchr/testify/assert"
2118
"github.com/stretchr/testify/require"
2219

2320
bolt "go.etcd.io/bbolt"
2421
main "go.etcd.io/bbolt/cmd/bbolt"
22+
"go.etcd.io/bbolt/internal/btesting"
23+
"go.etcd.io/bbolt/internal/guts_cli"
2524
)
2625

2726
// Ensure the "info" command can print information about a database.

internal/common/page.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,17 +334,17 @@ func (s Pgids) Len() int { return len(s) }
334334
func (s Pgids) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
335335
func (s Pgids) Less(i, j int) bool { return s[i] < s[j] }
336336

337-
// Merge returns the sorted union of a and b.
338-
func (a Pgids) Merge(b Pgids) Pgids {
337+
// Merge returns the sorted union of s and b.
338+
func (s Pgids) Merge(b Pgids) Pgids {
339339
// Return the opposite slice if one is nil.
340-
if len(a) == 0 {
340+
if len(s) == 0 {
341341
return b
342342
}
343343
if len(b) == 0 {
344-
return a
344+
return s
345345
}
346-
merged := make(Pgids, len(a)+len(b))
347-
Mergepgids(merged, a, b)
346+
merged := make(Pgids, len(s)+len(b))
347+
Mergepgids(merged, s, b)
348348
return merged
349349
}
350350

movebucket_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import (
77
"path/filepath"
88
"testing"
99

10+
"github.com/stretchr/testify/require"
11+
1012
"go.etcd.io/bbolt"
1113
"go.etcd.io/bbolt/errors"
1214
"go.etcd.io/bbolt/internal/btesting"
13-
14-
"github.com/stretchr/testify/require"
1515
)
1616

1717
func TestTx_MoveBucket(t *testing.T) {

tests/dmflakey/dmflakey_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import (
1212
"testing"
1313
"time"
1414

15-
testutils "go.etcd.io/bbolt/tests/utils"
16-
1715
"github.com/stretchr/testify/assert"
1816
"github.com/stretchr/testify/require"
1917
"golang.org/x/sys/unix"
18+
19+
testutils "go.etcd.io/bbolt/tests/utils"
2020
)
2121

2222
func TestMain(m *testing.M) {

tests/robustness/powerfailure_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import (
1919
"testing"
2020
"time"
2121

22-
"go.etcd.io/bbolt/tests/dmflakey"
23-
2422
"github.com/stretchr/testify/assert"
2523
"github.com/stretchr/testify/require"
2624
"golang.org/x/sys/unix"
25+
26+
"go.etcd.io/bbolt/tests/dmflakey"
2727
)
2828

2929
var panicFailpoints = []string{
@@ -140,7 +140,7 @@ func TestRestartFromPowerFailureXFS(t *testing.T) {
140140
}
141141

142142
func doPowerFailure(t *testing.T, du time.Duration, fsType dmflakey.FSType, mkfsOpt string, fsMountOpt string, useFailpoint bool) {
143-
flakey := initFlakeyDevice(t, strings.Replace(t.Name(), "/", "_", -1), fsType, mkfsOpt, fsMountOpt)
143+
flakey := initFlakeyDevice(t, strings.ReplaceAll(t.Name(), "/", "_"), fsType, mkfsOpt, fsMountOpt)
144144
root := flakey.RootFS()
145145

146146
dbPath := filepath.Join(root, "boltdb")

tx_check.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ func HexKVStringer() KVStringer {
281281

282282
type hexKvStringer struct{}
283283

284-
func (_ hexKvStringer) KeyToString(key []byte) string {
284+
func (hexKvStringer) KeyToString(key []byte) string {
285285
return hex.EncodeToString(key)
286286
}
287287

288-
func (_ hexKvStringer) ValueToString(value []byte) string {
288+
func (hexKvStringer) ValueToString(value []byte) string {
289289
return hex.EncodeToString(value)
290290
}

0 commit comments

Comments
 (0)