Skip to content

Commit 75af523

Browse files
committed
fix lint
1 parent 33f1295 commit 75af523

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

memiavl/db.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const (
2020
DefaultSnapshotInterval = 1000
2121
LockFileName = "LOCK"
2222
DefaultSnapshotWriterLimit = 4
23+
TmpSuffix = "-tmp"
2324
)
2425

2526
var errReadOnly = errors.New("db is read-only")
@@ -265,7 +266,7 @@ func removeTmpDirs(rootDir string) error {
265266
}
266267

267268
for _, entry := range entries {
268-
if !entry.IsDir() || !strings.HasSuffix(entry.Name(), "-tmp") {
269+
if !entry.IsDir() || !strings.HasSuffix(entry.Name(), TmpSuffix) {
269270
continue
270271
}
271272

@@ -636,7 +637,7 @@ func (db *DB) RewriteSnapshot() error {
636637
}
637638

638639
snapshotDir := snapshotName(db.lastCommitInfo.Version)
639-
tmpDir := snapshotDir + "-tmp"
640+
tmpDir := snapshotDir + TmpSuffix
640641
path := filepath.Join(db.dir, tmpDir)
641642
if err := db.MultiTree.WriteSnapshot(path, db.snapshotWriterPool); err != nil {
642643
return errors.Join(err, os.RemoveAll(path))
@@ -978,7 +979,7 @@ func traverseSnapshots(dir string, ascending bool, callback func(int64) (bool, e
978979

979980
// atomicRemoveDir is equavalent to `mv snapshot snapshot-tmp && rm -r snapshot-tmp`
980981
func atomicRemoveDir(path string) error {
981-
tmpPath := path + "-tmp"
982+
tmpPath := path + TmpSuffix
982983
if err := os.Rename(path, tmpPath); err != nil {
983984
return err
984985
}

memiavl/db_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestRemoveSnapshotDir(t *testing.T) {
4545
defer os.RemoveAll(dbDir)
4646

4747
snapshotDir := filepath.Join(dbDir, snapshotName(0))
48-
tmpDir := snapshotDir + "-tmp"
48+
tmpDir := snapshotDir + TmpSuffix
4949
if err := os.MkdirAll(tmpDir, os.ModePerm); err != nil {
5050
t.Fatalf("Failed to create dummy snapshot directory: %v", err)
5151
}

memiavl/import.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func NewMultiTreeImporter(dir string, height uint64) (*MultiTreeImporter, error)
3636
}
3737

3838
func (mti *MultiTreeImporter) tmpDir() string {
39-
return filepath.Join(mti.dir, mti.snapshotDir+"-tmp")
39+
return filepath.Join(mti.dir, mti.snapshotDir+TmpSuffix)
4040
}
4141

4242
func (mti *MultiTreeImporter) Add(item interface{}) error {

x/cronos/keeper/mock/ibckeeper_mock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func (i IbcKeeperMock) Transfer(goCtx context.Context, msg *types.MsgTransfer) (
1515
}
1616

1717
func (i IbcKeeperMock) GetDenomTrace(ctx sdk.Context, denomTraceHash tmbytes.HexBytes) (types.DenomTrace, bool) {
18-
if denomTraceHash.String() == "6B5A664BF0AF4F71B2F0BAA33141E2F1321242FBD5D19762F541EC971ACB0865" { //nolint:gosec // test only
18+
if denomTraceHash.String() == "6B5A664BF0AF4F71B2F0BAA33141E2F1321242FBD5D19762F541EC971ACB0865" {
1919
return types.DenomTrace{
2020
Path: "transfer/channel-0",
2121
BaseDenom: "basetcro",

0 commit comments

Comments
 (0)