From ec155022e7e8d0f30bfcfa169248ec3ecc40e960 Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 19 Dec 2024 19:23:27 -0800 Subject: [PATCH] "golang.org/x/exp/slices" => "slices" and go fmt --- weed/command/master.go | 2 +- weed/filer/filechunks2_test.go | 2 +- weed/filer/filechunks_read.go | 2 +- weed/filer/filer_notify.go | 2 +- weed/filer/meta_replay.go | 3 +-- weed/filer/redis/universal_redis_store.go | 2 +- weed/filer/redis3/redis_cluster_store.go | 2 +- weed/filer/redis3/redis_sentinel_store.go | 2 +- weed/filer/redis3/redis_store.go | 2 +- weed/filer/stream.go | 4 ++-- .../mq/client/cmd/weed_pub_kv/publisher_kv.go | 2 +- .../client/cmd/weed_sub_kv/subscriber_kv.go | 2 +- weed/mq/client/pub_client/publish.go | 2 +- weed/mq/pub_balancer/allocate_test.go | 24 +++++++++---------- .../consumer_group_instance.go | 4 ++-- .../inflight_message_tracker.go | 8 +++---- weed/mq/topic/local_topic.go | 2 +- weed/operation/upload_content.go | 12 +++++----- weed/pb/filer_pb/filer_client_bfs.go | 4 ++-- weed/replication/sink/azuresink/azure_sink.go | 2 +- weed/s3api/filer_multipart.go | 2 +- weed/s3api/s3api_acl_helper.go | 2 +- weed/s3api/s3api_object_handlers_delete.go | 2 ++ .../filer_server_handlers_write_cipher.go | 2 +- .../filer_server_handlers_write_upload.go | 2 +- weed/shell/command_ec_common.go | 2 +- weed/shell/command_fs_merge_volumes.go | 2 +- weed/shell/command_fs_verify.go | 2 +- weed/shell/command_volume_balance.go | 2 +- weed/shell/command_volume_check_disk.go | 2 +- weed/shell/command_volume_fix_replication.go | 6 ++--- weed/shell/command_volume_list.go | 2 +- weed/shell/command_volume_server_evacuate.go | 2 +- weed/shell/shell_liner.go | 2 +- weed/storage/disk_location_ec.go | 2 +- weed/storage/erasure_coding/ec_locate.go | 4 ++-- weed/storage/erasure_coding/ec_volume.go | 2 +- weed/topology/data_center.go | 2 +- weed/topology/rack.go | 2 +- weed/topology/topology_info.go | 2 +- weed/util/chunk_cache/on_disk_cache_layer.go | 2 +- weed/util/config.go | 4 ++-- weed/util/queue.go | 2 +- weed/util/skiplist/name_batch.go | 2 +- 44 files changed, 70 insertions(+), 71 deletions(-) diff --git a/weed/command/master.go b/weed/command/master.go index 79c783091..261670ce8 100644 --- a/weed/command/master.go +++ b/weed/command/master.go @@ -11,7 +11,7 @@ import ( hashicorpRaft "github.com/hashicorp/raft" - "golang.org/x/exp/slices" + "slices" "github.com/gorilla/mux" "github.com/seaweedfs/raft/protobuf" diff --git a/weed/filer/filechunks2_test.go b/weed/filer/filechunks2_test.go index 6728aec0d..dfa971f86 100644 --- a/weed/filer/filechunks2_test.go +++ b/weed/filer/filechunks2_test.go @@ -2,8 +2,8 @@ package filer import ( "github.com/stretchr/testify/assert" - "golang.org/x/exp/slices" "log" + "slices" "testing" "github.com/seaweedfs/seaweedfs/weed/glog" diff --git a/weed/filer/filechunks_read.go b/weed/filer/filechunks_read.go index 11b297a3c..756e18b34 100644 --- a/weed/filer/filechunks_read.go +++ b/weed/filer/filechunks_read.go @@ -3,7 +3,7 @@ package filer import ( "container/list" "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" - "golang.org/x/exp/slices" + "slices" ) func readResolvedChunks(chunks []*filer_pb.FileChunk, startOffset int64, stopOffset int64) (visibles *IntervalList[*VisibleInterval]) { diff --git a/weed/filer/filer_notify.go b/weed/filer/filer_notify.go index 621d4c227..4c99da72a 100644 --- a/weed/filer/filer_notify.go +++ b/weed/filer/filer_notify.go @@ -123,7 +123,7 @@ func (f *Filer) ReadPersistedLogBuffer(startPosition log_buffer.MessagePosition, err = fmt.Errorf("reading from persisted logs: %v", visitErr) return } - var logEntry *filer_pb.LogEntry + var logEntry *filer_pb.LogEntry for { logEntry, visitErr = visitor.GetNext() if visitErr != nil { diff --git a/weed/filer/meta_replay.go b/weed/filer/meta_replay.go index 0432e17de..f6b009e92 100644 --- a/weed/filer/meta_replay.go +++ b/weed/filer/meta_replay.go @@ -37,10 +37,9 @@ func Replay(filerStore FilerStore, resp *filer_pb.SubscribeMetadataResponse) err return nil } - // ParallelProcessDirectoryStructure processes each entry in parallel, and also ensure parent directories are processed first. // This also assumes the parent directories are in the entryChan already. -func ParallelProcessDirectoryStructure(entryChan chan *Entry, concurrency int, eachEntryFn func(entry *Entry)(error)) (firstErr error) { +func ParallelProcessDirectoryStructure(entryChan chan *Entry, concurrency int, eachEntryFn func(entry *Entry) error) (firstErr error) { executors := util.NewLimitedConcurrentExecutor(concurrency) diff --git a/weed/filer/redis/universal_redis_store.go b/weed/filer/redis/universal_redis_store.go index 8c8d6539c..5e7c850d0 100644 --- a/weed/filer/redis/universal_redis_store.go +++ b/weed/filer/redis/universal_redis_store.go @@ -3,7 +3,7 @@ package redis import ( "context" "fmt" - "golang.org/x/exp/slices" + "slices" "strings" "time" diff --git a/weed/filer/redis3/redis_cluster_store.go b/weed/filer/redis3/redis_cluster_store.go index a8858bfa9..cb8c1896d 100644 --- a/weed/filer/redis3/redis_cluster_store.go +++ b/weed/filer/redis3/redis_cluster_store.go @@ -1,9 +1,9 @@ package redis3 import ( - "github.com/redis/go-redis/v9" "github.com/go-redsync/redsync/v4" "github.com/go-redsync/redsync/v4/redis/goredis/v9" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" ) diff --git a/weed/filer/redis3/redis_sentinel_store.go b/weed/filer/redis3/redis_sentinel_store.go index 2e0a8d4ae..b9b0354e0 100644 --- a/weed/filer/redis3/redis_sentinel_store.go +++ b/weed/filer/redis3/redis_sentinel_store.go @@ -3,9 +3,9 @@ package redis3 import ( "time" - "github.com/redis/go-redis/v9" "github.com/go-redsync/redsync/v4" "github.com/go-redsync/redsync/v4/redis/goredis/v9" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" ) diff --git a/weed/filer/redis3/redis_store.go b/weed/filer/redis3/redis_store.go index 339115563..fbcb6d10d 100644 --- a/weed/filer/redis3/redis_store.go +++ b/weed/filer/redis3/redis_store.go @@ -1,9 +1,9 @@ package redis3 import ( - "github.com/redis/go-redis/v9" "github.com/go-redsync/redsync/v4" "github.com/go-redsync/redsync/v4/redis/goredis/v9" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" ) diff --git a/weed/filer/stream.go b/weed/filer/stream.go index fdb443b53..2f55e3e44 100644 --- a/weed/filer/stream.go +++ b/weed/filer/stream.go @@ -9,14 +9,14 @@ import ( "sync" "time" - "golang.org/x/exp/slices" + "slices" "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" "github.com/seaweedfs/seaweedfs/weed/stats" "github.com/seaweedfs/seaweedfs/weed/util" - "github.com/seaweedfs/seaweedfs/weed/wdclient" util_http "github.com/seaweedfs/seaweedfs/weed/util/http" + "github.com/seaweedfs/seaweedfs/weed/wdclient" ) var getLookupFileIdBackoffSchedule = []time.Duration{ diff --git a/weed/mq/client/cmd/weed_pub_kv/publisher_kv.go b/weed/mq/client/cmd/weed_pub_kv/publisher_kv.go index 3ab3cb251..b4d07ae02 100644 --- a/weed/mq/client/cmd/weed_pub_kv/publisher_kv.go +++ b/weed/mq/client/cmd/weed_pub_kv/publisher_kv.go @@ -5,11 +5,11 @@ import ( "fmt" "github.com/seaweedfs/seaweedfs/weed/mq/client/pub_client" "github.com/seaweedfs/seaweedfs/weed/mq/topic" + util_http "github.com/seaweedfs/seaweedfs/weed/util/http" "log" "strings" "sync" "time" - util_http "github.com/seaweedfs/seaweedfs/weed/util/http" ) var ( diff --git a/weed/mq/client/cmd/weed_sub_kv/subscriber_kv.go b/weed/mq/client/cmd/weed_sub_kv/subscriber_kv.go index 8ff667763..d51fdf7af 100644 --- a/weed/mq/client/cmd/weed_sub_kv/subscriber_kv.go +++ b/weed/mq/client/cmd/weed_sub_kv/subscriber_kv.go @@ -7,11 +7,11 @@ import ( "github.com/seaweedfs/seaweedfs/weed/mq/client/sub_client" "github.com/seaweedfs/seaweedfs/weed/mq/topic" "github.com/seaweedfs/seaweedfs/weed/util" + util_http "github.com/seaweedfs/seaweedfs/weed/util/http" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "strings" "time" - util_http "github.com/seaweedfs/seaweedfs/weed/util/http" ) var ( diff --git a/weed/mq/client/pub_client/publish.go b/weed/mq/client/pub_client/publish.go index a85eec31f..2a31a2185 100644 --- a/weed/mq/client/pub_client/publish.go +++ b/weed/mq/client/pub_client/publish.go @@ -50,7 +50,7 @@ func (p *TopicPublisher) FinishPublish() error { inputBuffer.Enqueue(&mq_pb.DataMessage{ TsNs: time.Now().UnixNano(), Ctrl: &mq_pb.ControlMessage{ - IsClose: true, + IsClose: true, PublisherName: p.config.PublisherName, }, }) diff --git a/weed/mq/pub_balancer/allocate_test.go b/weed/mq/pub_balancer/allocate_test.go index 4b36af388..63692af0f 100644 --- a/weed/mq/pub_balancer/allocate_test.go +++ b/weed/mq/pub_balancer/allocate_test.go @@ -95,8 +95,8 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) { followerCount: 1, assignments: []*mq_pb.BrokerPartitionAssignment{ { - LeaderBroker: "", - Partition: &mq_pb.Partition{}, + LeaderBroker: "", + Partition: &mq_pb.Partition{}, FollowerBroker: "localhost:2", }, }, @@ -110,8 +110,8 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) { followerCount: 1, assignments: []*mq_pb.BrokerPartitionAssignment{ { - LeaderBroker: "localhost:1", - Partition: &mq_pb.Partition{}, + LeaderBroker: "localhost:1", + Partition: &mq_pb.Partition{}, FollowerBroker: "", }, }, @@ -125,8 +125,8 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) { followerCount: 1, assignments: []*mq_pb.BrokerPartitionAssignment{ { - LeaderBroker: "localhost:1", - Partition: &mq_pb.Partition{}, + LeaderBroker: "localhost:1", + Partition: &mq_pb.Partition{}, FollowerBroker: "localhost:200", }, }, @@ -140,8 +140,8 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) { followerCount: 1, assignments: []*mq_pb.BrokerPartitionAssignment{ { - LeaderBroker: "localhost:100", - Partition: &mq_pb.Partition{}, + LeaderBroker: "localhost:100", + Partition: &mq_pb.Partition{}, FollowerBroker: "localhost:200", }, }, @@ -155,8 +155,8 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) { followerCount: 3, assignments: []*mq_pb.BrokerPartitionAssignment{ { - LeaderBroker: "localhost:1", - Partition: &mq_pb.Partition{}, + LeaderBroker: "localhost:1", + Partition: &mq_pb.Partition{}, FollowerBroker: "localhost:2", }, }, @@ -184,8 +184,8 @@ func TestEnsureAssignmentsToActiveBrokersX(t *testing.T) { followerCount: 3, assignments: []*mq_pb.BrokerPartitionAssignment{ { - LeaderBroker: "localhost:1", - Partition: &mq_pb.Partition{}, + LeaderBroker: "localhost:1", + Partition: &mq_pb.Partition{}, FollowerBroker: "localhost:2", }, }, diff --git a/weed/mq/sub_coordinator/consumer_group_instance.go b/weed/mq/sub_coordinator/consumer_group_instance.go index fce7dde66..74a35b40a 100644 --- a/weed/mq/sub_coordinator/consumer_group_instance.go +++ b/weed/mq/sub_coordinator/consumer_group_instance.go @@ -16,8 +16,8 @@ type ConsumerGroupInstance struct { func NewConsumerGroupInstance(instanceId string, maxPartitionCount int32) *ConsumerGroupInstance { return &ConsumerGroupInstance{ - InstanceId: ConsumerGroupInstanceId(instanceId), - ResponseChan: make(chan *mq_pb.SubscriberToSubCoordinatorResponse, 1), + InstanceId: ConsumerGroupInstanceId(instanceId), + ResponseChan: make(chan *mq_pb.SubscriberToSubCoordinatorResponse, 1), MaxPartitionCount: maxPartitionCount, } } diff --git a/weed/mq/sub_coordinator/inflight_message_tracker.go b/weed/mq/sub_coordinator/inflight_message_tracker.go index f1c46e06b..2cdfbc4e5 100644 --- a/weed/mq/sub_coordinator/inflight_message_tracker.go +++ b/weed/mq/sub_coordinator/inflight_message_tracker.go @@ -84,9 +84,9 @@ type TimestampStatus struct { // RingBuffer represents a circular buffer to hold timestamps. type RingBuffer struct { - buffer []*TimestampStatus - head int - size int + buffer []*TimestampStatus + head int + size int maxTimestamp int64 maxAllAckedTs int64 } @@ -111,7 +111,7 @@ func (rb *RingBuffer) EnflightTimestamp(timestamp int64) { if rb.size < len(rb.buffer) { rb.size++ } else { - newBuf := newBuffer(2*len(rb.buffer)) + newBuf := newBuffer(2 * len(rb.buffer)) for i := 0; i < rb.size; i++ { newBuf[i] = rb.buffer[(rb.head+len(rb.buffer)-rb.size+i)%len(rb.buffer)] } diff --git a/weed/mq/topic/local_topic.go b/weed/mq/topic/local_topic.go index 25ae03df6..a35bb32b3 100644 --- a/weed/mq/topic/local_topic.go +++ b/weed/mq/topic/local_topic.go @@ -4,7 +4,7 @@ import "sync" type LocalTopic struct { Topic - Partitions []*LocalPartition + Partitions []*LocalPartition partitionLock sync.RWMutex } diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.go index a8e8a85b0..0cf6bf7cf 100644 --- a/weed/operation/upload_content.go +++ b/weed/operation/upload_content.go @@ -9,11 +9,11 @@ import ( "io" "mime" "mime/multipart" - "sync" "net/http" "net/textproto" "path/filepath" "strings" + "sync" "time" "github.com/seaweedfs/seaweedfs/weed/glog" @@ -66,9 +66,9 @@ func (uploadResult *UploadResult) ToPbFileChunk(fileId string, offset int64, tsN var ( fileNameEscaper = strings.NewReplacer(`\`, `\\`, `"`, `\"`, "\n", "") - uploader *Uploader - uploaderErr error - once sync.Once + uploader *Uploader + uploaderErr error + once sync.Once ) // HTTPClient interface for testing @@ -82,7 +82,7 @@ type Uploader struct { } func NewUploader() (*Uploader, error) { - once.Do(func () { + once.Do(func() { // With Dial context var httpClient *util_http_client.HTTPClient httpClient, uploaderErr = util_http.NewGlobalHttpClient(util_http_client.AddDialContext) @@ -96,7 +96,7 @@ func NewUploader() (*Uploader, error) { return uploader, uploaderErr } -func newUploader(httpClient HTTPClient) (*Uploader) { +func newUploader(httpClient HTTPClient) *Uploader { return &Uploader{ httpClient: httpClient, } diff --git a/weed/pb/filer_pb/filer_client_bfs.go b/weed/pb/filer_pb/filer_client_bfs.go index 046920940..e43443706 100644 --- a/weed/pb/filer_pb/filer_client_bfs.go +++ b/weed/pb/filer_pb/filer_client_bfs.go @@ -69,7 +69,7 @@ func processOneDirectory(filerClient FilerClient, parentPath util.FullPath, queu } -func StreamBfs(client SeaweedFilerClient, dir util.FullPath, olderThanTsNs int64, fn func(parentPath util.FullPath, entry *Entry)error) (err error) { +func StreamBfs(client SeaweedFilerClient, dir util.FullPath, olderThanTsNs int64, fn func(parentPath util.FullPath, entry *Entry) error) (err error) { glog.V(0).Infof("TraverseBfsMetadata %v if before %v", dir, time.Unix(0, olderThanTsNs)) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -87,7 +87,7 @@ func StreamBfs(client SeaweedFilerClient, dir util.FullPath, olderThanTsNs int64 } return fmt.Errorf("traverse bfs metadata: %v", err) } - if err := fn(util.FullPath(resp.Directory), resp.Entry); err != nil { + if err := fn(util.FullPath(resp.Directory), resp.Entry); err != nil { return err } } diff --git a/weed/replication/sink/azuresink/azure_sink.go b/weed/replication/sink/azuresink/azure_sink.go index 890e68fd4..fb2f9ff82 100644 --- a/weed/replication/sink/azuresink/azure_sink.go +++ b/weed/replication/sink/azuresink/azure_sink.go @@ -112,7 +112,7 @@ func (g *AzureSink) CreateEntry(key string, entry *filer_pb.Entry, signatures [] appendBlobURL := g.containerURL.NewAppendBlobURL(key) accessCondition := azblob.BlobAccessConditions{} - if entry.Attributes!=nil && entry.Attributes.Mtime>0 { + if entry.Attributes != nil && entry.Attributes.Mtime > 0 { accessCondition.ModifiedAccessConditions.IfUnmodifiedSince = time.Unix(entry.Attributes.Mtime, 0) } diff --git a/weed/s3api/filer_multipart.go b/weed/s3api/filer_multipart.go index 12ffc78de..3346fdf5f 100644 --- a/weed/s3api/filer_multipart.go +++ b/weed/s3api/filer_multipart.go @@ -7,9 +7,9 @@ import ( "fmt" "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" "github.com/seaweedfs/seaweedfs/weed/stats" - "golang.org/x/exp/slices" "math" "path/filepath" + "slices" "sort" "strconv" "strings" diff --git a/weed/s3api/s3api_acl_helper.go b/weed/s3api/s3api_acl_helper.go index b9fb1131e..f036a9ea7 100644 --- a/weed/s3api/s3api_acl_helper.go +++ b/weed/s3api/s3api_acl_helper.go @@ -9,9 +9,9 @@ import ( "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" "github.com/seaweedfs/seaweedfs/weed/s3api/s3err" + util_http "github.com/seaweedfs/seaweedfs/weed/util/http" "net/http" "strings" - util_http "github.com/seaweedfs/seaweedfs/weed/util/http" ) type AccountManager interface { diff --git a/weed/s3api/s3api_object_handlers_delete.go b/weed/s3api/s3api_object_handlers_delete.go index 506e7609b..0f765b62c 100644 --- a/weed/s3api/s3api_object_handlers_delete.go +++ b/weed/s3api/s3api_object_handlers_delete.go @@ -3,8 +3,10 @@ package s3api import ( "encoding/xml" "fmt" + "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" "io" "net/http" + "slices" "strings" "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" diff --git a/weed/server/filer_server_handlers_write_cipher.go b/weed/server/filer_server_handlers_write_cipher.go index f8d129bf3..9c1628749 100644 --- a/weed/server/filer_server_handlers_write_cipher.go +++ b/weed/server/filer_server_handlers_write_cipher.go @@ -53,7 +53,7 @@ func (fs *FilerServer) encrypt(ctx context.Context, w http.ResponseWriter, r *ht PairMap: pu.PairMap, Jwt: auth, } - + uploader, uploaderErr := operation.NewUploader() if uploaderErr != nil { return nil, fmt.Errorf("uploader initialization error: %v", uploaderErr) diff --git a/weed/server/filer_server_handlers_write_upload.go b/weed/server/filer_server_handlers_write_upload.go index fce2a6413..79f794110 100644 --- a/weed/server/filer_server_handlers_write_upload.go +++ b/weed/server/filer_server_handlers_write_upload.go @@ -11,7 +11,7 @@ import ( "sync" "time" - "golang.org/x/exp/slices" + "slices" "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/operation" diff --git a/weed/shell/command_ec_common.go b/weed/shell/command_ec_common.go index e4629905e..0e9062d23 100644 --- a/weed/shell/command_ec_common.go +++ b/weed/shell/command_ec_common.go @@ -18,8 +18,8 @@ import ( "github.com/seaweedfs/seaweedfs/weed/storage/needle" "github.com/seaweedfs/seaweedfs/weed/storage/super_block" "github.com/seaweedfs/seaweedfs/weed/storage/types" - "golang.org/x/exp/slices" "google.golang.org/grpc" + "slices" ) type DataCenterId string diff --git a/weed/shell/command_fs_merge_volumes.go b/weed/shell/command_fs_merge_volumes.go index d35f63c0a..3037480c1 100644 --- a/weed/shell/command_fs_merge_volumes.go +++ b/weed/shell/command_fs_merge_volumes.go @@ -13,7 +13,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/storage/needle" "github.com/seaweedfs/seaweedfs/weed/wdclient" "golang.org/x/exp/maps" - "golang.org/x/exp/slices" + "slices" "github.com/seaweedfs/seaweedfs/weed/operation" "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" diff --git a/weed/shell/command_fs_verify.go b/weed/shell/command_fs_verify.go index 2cd7f06dc..dcac60874 100644 --- a/weed/shell/command_fs_verify.go +++ b/weed/shell/command_fs_verify.go @@ -20,7 +20,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/storage" "github.com/seaweedfs/seaweedfs/weed/util" "go.uber.org/atomic" - "golang.org/x/exp/slices" + "slices" ) func init() { diff --git a/weed/shell/command_volume_balance.go b/weed/shell/command_volume_balance.go index 7b2fc7472..48825c616 100644 --- a/weed/shell/command_volume_balance.go +++ b/weed/shell/command_volume_balance.go @@ -13,7 +13,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding" "github.com/seaweedfs/seaweedfs/weed/storage/super_block" "github.com/seaweedfs/seaweedfs/weed/storage/types" - "golang.org/x/exp/slices" + "slices" "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" "github.com/seaweedfs/seaweedfs/weed/storage/needle" diff --git a/weed/shell/command_volume_check_disk.go b/weed/shell/command_volume_check_disk.go index f72dff243..06154b92b 100644 --- a/weed/shell/command_volume_check_disk.go +++ b/weed/shell/command_volume_check_disk.go @@ -17,8 +17,8 @@ import ( "github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb" "github.com/seaweedfs/seaweedfs/weed/server/constants" "github.com/seaweedfs/seaweedfs/weed/storage/needle_map" - "golang.org/x/exp/slices" "google.golang.org/grpc" + "slices" ) func init() { diff --git a/weed/shell/command_volume_fix_replication.go b/weed/shell/command_volume_fix_replication.go index 0b9ed09b7..f664ccbb2 100644 --- a/weed/shell/command_volume_fix_replication.go +++ b/weed/shell/command_volume_fix_replication.go @@ -13,10 +13,8 @@ import ( "github.com/seaweedfs/seaweedfs/weed/storage/needle" "github.com/seaweedfs/seaweedfs/weed/storage/needle_map" "github.com/seaweedfs/seaweedfs/weed/storage/types" - "github.com/seaweedfs/seaweedfs/weed/util" - - "golang.org/x/exp/slices" "google.golang.org/grpc" + "slices" "github.com/seaweedfs/seaweedfs/weed/operation" "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" @@ -346,7 +344,7 @@ func (c *commandVolumeFixReplication) fixOneUnderReplicatedVolume(commandEnv *Co } } if resp.ProcessedBytes > 0 { - fmt.Fprintf(writer, "volume %d processed %s bytes\n", replica.info.Id, util.BytesToHumanReadable(uint64(resp.ProcessedBytes))) + fmt.Fprintf(writer, "volume %d processed %d bytes\n", replica.info.Id, resp.ProcessedBytes) } } diff --git a/weed/shell/command_volume_list.go b/weed/shell/command_volume_list.go index 3b11bf100..99fd1420b 100644 --- a/weed/shell/command_volume_list.go +++ b/weed/shell/command_volume_list.go @@ -7,8 +7,8 @@ import ( "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" "github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding" "github.com/seaweedfs/seaweedfs/weed/storage/types" - "golang.org/x/exp/slices" "path/filepath" + "slices" "strings" "time" diff --git a/weed/shell/command_volume_server_evacuate.go b/weed/shell/command_volume_server_evacuate.go index 5c7c903de..8f7b81003 100644 --- a/weed/shell/command_volume_server_evacuate.go +++ b/weed/shell/command_volume_server_evacuate.go @@ -11,7 +11,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/storage/needle" "github.com/seaweedfs/seaweedfs/weed/storage/super_block" "github.com/seaweedfs/seaweedfs/weed/storage/types" - "golang.org/x/exp/slices" + "slices" ) func init() { diff --git a/weed/shell/shell_liner.go b/weed/shell/shell_liner.go index 407dce006..1a4cabad8 100644 --- a/weed/shell/shell_liner.go +++ b/weed/shell/shell_liner.go @@ -8,12 +8,12 @@ import ( "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" "github.com/seaweedfs/seaweedfs/weed/util" "github.com/seaweedfs/seaweedfs/weed/util/grace" - "golang.org/x/exp/slices" "io" "math/rand" "os" "path" "regexp" + "slices" "strings" "github.com/peterh/liner" diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go index ac8d52fb7..44a6c03ab 100644 --- a/weed/storage/disk_location_ec.go +++ b/weed/storage/disk_location_ec.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "golang.org/x/exp/slices" + "slices" "github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding" "github.com/seaweedfs/seaweedfs/weed/storage/needle" diff --git a/weed/storage/erasure_coding/ec_locate.go b/weed/storage/erasure_coding/ec_locate.go index 72f8739ad..22839a809 100644 --- a/weed/storage/erasure_coding/ec_locate.go +++ b/weed/storage/erasure_coding/ec_locate.go @@ -5,7 +5,7 @@ import ( ) type Interval struct { - BlockIndex int // the index of the block in either the large blocks or the small blocks + BlockIndex int // the index of the block in either the large blocks or the small blocks InnerBlockOffset int64 Size types.Size IsLargeBlock bool // whether the block is a large block or a small block @@ -50,7 +50,7 @@ func LocateData(largeBlockLength, smallBlockLength int64, shardDatSize int64, of func locateOffset(largeBlockLength, smallBlockLength int64, shardDatSize int64, offset int64) (blockIndex int, isLargeBlock bool, nLargeBlockRows int64, innerBlockOffset int64) { largeRowSize := largeBlockLength * DataShardsCount - nLargeBlockRows = (shardDatSize-1)/ largeBlockLength + nLargeBlockRows = (shardDatSize - 1) / largeBlockLength // if offset is within the large block area if offset < nLargeBlockRows*largeRowSize { diff --git a/weed/storage/erasure_coding/ec_volume.go b/weed/storage/erasure_coding/ec_volume.go index 385d30abe..ed3ce4e2f 100644 --- a/weed/storage/erasure_coding/ec_volume.go +++ b/weed/storage/erasure_coding/ec_volume.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "golang.org/x/exp/slices" + "slices" "github.com/seaweedfs/seaweedfs/weed/pb" "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" diff --git a/weed/topology/data_center.go b/weed/topology/data_center.go index 55b17e911..03fe20c10 100644 --- a/weed/topology/data_center.go +++ b/weed/topology/data_center.go @@ -2,7 +2,7 @@ package topology import ( "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" - "golang.org/x/exp/slices" + "slices" "strings" ) diff --git a/weed/topology/rack.go b/weed/topology/rack.go index 6bf8b5b4e..d82ef7986 100644 --- a/weed/topology/rack.go +++ b/weed/topology/rack.go @@ -4,7 +4,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" "github.com/seaweedfs/seaweedfs/weed/storage/types" "github.com/seaweedfs/seaweedfs/weed/util" - "golang.org/x/exp/slices" + "slices" "strings" "time" ) diff --git a/weed/topology/topology_info.go b/weed/topology/topology_info.go index 33a047b1e..9c0a14991 100644 --- a/weed/topology/topology_info.go +++ b/weed/topology/topology_info.go @@ -2,7 +2,7 @@ package topology import ( "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" - "golang.org/x/exp/slices" + "slices" "strings" ) diff --git a/weed/util/chunk_cache/on_disk_cache_layer.go b/weed/util/chunk_cache/on_disk_cache_layer.go index b89b4aab8..fdbaef7c2 100644 --- a/weed/util/chunk_cache/on_disk_cache_layer.go +++ b/weed/util/chunk_cache/on_disk_cache_layer.go @@ -5,8 +5,8 @@ import ( "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/storage" "github.com/seaweedfs/seaweedfs/weed/storage/types" - "golang.org/x/exp/slices" "path" + "slices" ) type OnDiskCacheLayer struct { diff --git a/weed/util/config.go b/weed/util/config.go index 7ac765ff5..e5b32d512 100644 --- a/weed/util/config.go +++ b/weed/util/config.go @@ -11,7 +11,7 @@ import ( var ( ConfigurationFileDirectory DirectoryValueType - loadSecurityConfigOnce sync.Once + loadSecurityConfigOnce sync.Once ) type DirectoryValueType string @@ -32,7 +32,7 @@ type Configuration interface { SetDefault(key string, value interface{}) } -func LoadSecurityConfiguration(){ +func LoadSecurityConfiguration() { loadSecurityConfigOnce.Do(func() { LoadConfiguration("security", false) }) diff --git a/weed/util/queue.go b/weed/util/queue.go index 69efc078f..3c6d0fbf0 100644 --- a/weed/util/queue.go +++ b/weed/util/queue.go @@ -4,7 +4,7 @@ import ( "sync" ) -type node[T any]struct { +type node[T any] struct { data T next *node[T] } diff --git a/weed/util/skiplist/name_batch.go b/weed/util/skiplist/name_batch.go index 0556f48be..1ab2a6b1f 100644 --- a/weed/util/skiplist/name_batch.go +++ b/weed/util/skiplist/name_batch.go @@ -2,8 +2,8 @@ package skiplist import ( "github.com/seaweedfs/seaweedfs/weed/glog" - "golang.org/x/exp/slices" "google.golang.org/protobuf/proto" + "slices" "strings" )