From 4d9a6c07fbecb39f29439eb8558136ccc0fe45f8 Mon Sep 17 00:00:00 2001 From: Alexander Chuprov Date: Wed, 16 Aug 2023 18:30:33 +0300 Subject: [PATCH] [#618] core: Replace fmt.Sprintf with strconv.FormatUint Signed-off-by: Alexander Chuprov --- pkg/local_object_storage/engine/tree.go | 10 +++++----- pkg/local_object_storage/pilorama/boltdb.go | 9 +++++---- pkg/local_object_storage/shard/tree.go | 10 +++++----- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/pkg/local_object_storage/engine/tree.go b/pkg/local_object_storage/engine/tree.go index df3e919ec..55b9f9c50 100644 --- a/pkg/local_object_storage/engine/tree.go +++ b/pkg/local_object_storage/engine/tree.go @@ -3,7 +3,7 @@ package engine import ( "context" "errors" - "fmt" + "strconv" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard" @@ -145,7 +145,7 @@ func (e *StorageEngine) TreeGetMeta(ctx context.Context, cid cidSDK.ID, treeID s trace.WithAttributes( attribute.String("container_id", cid.EncodeToString()), attribute.String("tree_id", treeID), - attribute.String("node_id", fmt.Sprintf("%d", nodeID)), + attribute.String("node_id", strconv.FormatUint(nodeID, 10)), ), ) defer span.End() @@ -177,7 +177,7 @@ func (e *StorageEngine) TreeGetChildren(ctx context.Context, cid cidSDK.ID, tree trace.WithAttributes( attribute.String("container_id", cid.EncodeToString()), attribute.String("tree_id", treeID), - attribute.String("node_id", fmt.Sprintf("%d", nodeID)), + attribute.String("node_id", strconv.FormatUint(nodeID, 10)), ), ) defer span.End() @@ -208,7 +208,7 @@ func (e *StorageEngine) TreeGetOpLog(ctx context.Context, cid cidSDK.ID, treeID trace.WithAttributes( attribute.String("container_id", cid.EncodeToString()), attribute.String("tree_id", treeID), - attribute.String("height", fmt.Sprintf("%d", height)), + attribute.String("height", strconv.FormatUint(height, 10)), ), ) defer span.End() @@ -333,7 +333,7 @@ func (e *StorageEngine) TreeUpdateLastSyncHeight(ctx context.Context, cid cidSDK trace.WithAttributes( attribute.String("container_id", cid.EncodeToString()), attribute.String("tree_id", treeID), - attribute.String("height", fmt.Sprintf("%d", height)), + attribute.String("height", strconv.FormatUint(height, 10)), ), ) defer span.End() diff --git a/pkg/local_object_storage/pilorama/boltdb.go b/pkg/local_object_storage/pilorama/boltdb.go index 33d2b6878..c9a9f039e 100644 --- a/pkg/local_object_storage/pilorama/boltdb.go +++ b/pkg/local_object_storage/pilorama/boltdb.go @@ -9,6 +9,7 @@ import ( "math/rand" "os" "path/filepath" + "strconv" "sync" "time" @@ -291,7 +292,7 @@ func (t *boltForest) TreeUpdateLastSyncHeight(ctx context.Context, cid cidSDK.ID trace.WithAttributes( attribute.String("container_id", cid.EncodeToString()), attribute.String("tree_id", treeID), - attribute.String("height", fmt.Sprintf("%d", height)), + attribute.String("height", strconv.FormatUint(height, 10)), ), ) defer span.End() @@ -889,7 +890,7 @@ func (t *boltForest) TreeGetMeta(ctx context.Context, cid cidSDK.ID, treeID stri trace.WithAttributes( attribute.String("container_id", cid.EncodeToString()), attribute.String("tree_id", treeID), - attribute.String("node_id", fmt.Sprintf("%d", nodeID)), + attribute.String("node_id", strconv.FormatUint(nodeID, 10)), ), ) defer span.End() @@ -937,7 +938,7 @@ func (t *boltForest) TreeGetChildren(ctx context.Context, cid cidSDK.ID, treeID trace.WithAttributes( attribute.String("container_id", cid.EncodeToString()), attribute.String("tree_id", treeID), - attribute.String("node_id", fmt.Sprintf("%d", nodeID)), + attribute.String("node_id", strconv.FormatUint(nodeID, 10)), ), ) defer span.End() @@ -1046,7 +1047,7 @@ func (t *boltForest) TreeGetOpLog(ctx context.Context, cid cidSDK.ID, treeID str trace.WithAttributes( attribute.String("container_id", cid.EncodeToString()), attribute.String("tree_id", treeID), - attribute.String("height", fmt.Sprintf("%d", height)), + attribute.String("height", strconv.FormatUint(height, 10)), ), ) defer span.End() diff --git a/pkg/local_object_storage/shard/tree.go b/pkg/local_object_storage/shard/tree.go index 7e2c80152..7795b820d 100644 --- a/pkg/local_object_storage/shard/tree.go +++ b/pkg/local_object_storage/shard/tree.go @@ -2,7 +2,7 @@ package shard import ( "context" - "fmt" + "strconv" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" @@ -140,7 +140,7 @@ func (s *Shard) TreeGetMeta(ctx context.Context, cid cidSDK.ID, treeID string, n attribute.String("shard_id", s.ID().String()), attribute.String("container_id", cid.EncodeToString()), attribute.String("tree_id", treeID), - attribute.String("node_id", fmt.Sprintf("%d", nodeID)), + attribute.String("node_id", strconv.FormatUint(nodeID, 10)), ), ) defer span.End() @@ -165,7 +165,7 @@ func (s *Shard) TreeGetChildren(ctx context.Context, cid cidSDK.ID, treeID strin attribute.String("shard_id", s.ID().String()), attribute.String("container_id", cid.EncodeToString()), attribute.String("tree_id", treeID), - attribute.String("node_id", fmt.Sprintf("%d", nodeID)), + attribute.String("node_id", strconv.FormatUint(nodeID, 10)), ), ) defer span.End() @@ -190,7 +190,7 @@ func (s *Shard) TreeGetOpLog(ctx context.Context, cid cidSDK.ID, treeID string, attribute.String("shard_id", s.ID().String()), attribute.String("container_id", cid.EncodeToString()), attribute.String("tree_id", treeID), - attribute.String("height", fmt.Sprintf("%d", height)), + attribute.String("height", strconv.FormatUint(height, 10)), ), ) defer span.End() @@ -309,7 +309,7 @@ func (s *Shard) TreeUpdateLastSyncHeight(ctx context.Context, cid cidSDK.ID, tre attribute.String("shard_id", s.ID().String()), attribute.String("container_id", cid.EncodeToString()), attribute.String("tree_id", treeID), - attribute.String("height", fmt.Sprintf("%d", height)), + attribute.String("height", strconv.FormatUint(height, 10)), ), ) defer span.End()