-
Notifications
You must be signed in to change notification settings - Fork 0
chore: execute goimports to format the code #2
base: replay-7983-base-e67973d
Are you sure you want to change the base?
chore: execute goimports to format the code #2
Conversation
Signed-off-by: promalert <promalert@outlook.com>
📝 WalkthroughWalkthroughThis pull request systematically reorganizes import blocks across 200+ files throughout the codebase. The changes primarily involve reordering imports, consolidating duplicate imports, adding/removing blank line separators, and minor formatting adjustments. A small number of files also receive trivial behavioral updates. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes The diff spans 200+ files with primarily homogeneous changes (import reorganization, whitespace adjustments, duplicate consolidation). While the volume is substantial, the repetitive nature and straightforward pattern of most changes allows for efficient review scanning, though the sheer breadth of files requires careful verification across the codebase. Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @weed/command/mini.go:
- Around line 1168-1171: The welcome message uses escaped backslash-n sequences
so the output shows "\n" literally; update the four sb.WriteString calls that
currently contain "\\n" (the lines writing " export
AWS_ACCESS_KEY_ID=your-access-key\\n", " export
AWS_SECRET_ACCESS_KEY=your-secret-key\\n", " weed mini -dir=/data\\n", and "
This will create initial credentials for the 'mini' user.\\n") to use real
newline escapes ("\n") so sb.WriteString writes actual newlines instead of
literal backslash-n characters.
In @weed/filer/mysql/mysql_store.go:
- Around line 12-14: The import block redundantly imports
"github.com/go-sql-driver/mysql" twice (once regular and once as a
side-effect-only `_` import) even though the code calls mysql.RegisterTLSConfig
and mysql.ParseDSN; remove the `_ "github.com/go-sql-driver/mysql"` entry so
only the regular import remains, ensuring calls to mysql.RegisterTLSConfig and
mysql.ParseDSN still resolve and no side-effect import duplicates exist.
📜 Review details
Configuration used: Environment YAML
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (22)
telemetry/proto/telemetry.pb.gois excluded by!**/*.pb.gotest/kafka/kafka-client-loadtest/internal/schema/pb/loadtest.pb.gois excluded by!**/*.pb.goweed/pb/filer_pb/filer.pb.gois excluded by!**/*.pb.goweed/pb/filer_pb/filer_grpc.pb.gois excluded by!**/*.pb.goweed/pb/iam_pb/iam.pb.gois excluded by!**/*.pb.goweed/pb/master_pb/master.pb.gois excluded by!**/*.pb.goweed/pb/master_pb/master_grpc.pb.gois excluded by!**/*.pb.goweed/pb/mount_pb/mount.pb.gois excluded by!**/*.pb.goweed/pb/mount_pb/mount_grpc.pb.gois excluded by!**/*.pb.goweed/pb/mq_agent_pb/mq_agent.pb.gois excluded by!**/*.pb.goweed/pb/mq_agent_pb/mq_agent_grpc.pb.gois excluded by!**/*.pb.goweed/pb/mq_pb/mq_broker.pb.gois excluded by!**/*.pb.goweed/pb/mq_pb/mq_broker_grpc.pb.gois excluded by!**/*.pb.goweed/pb/remote_pb/remote.pb.gois excluded by!**/*.pb.goweed/pb/s3_pb/s3.pb.gois excluded by!**/*.pb.goweed/pb/s3_pb/s3_grpc.pb.gois excluded by!**/*.pb.goweed/pb/schema_pb/mq_schema.pb.gois excluded by!**/*.pb.goweed/pb/volume_server_pb/volume_server.pb.gois excluded by!**/*.pb.goweed/pb/volume_server_pb/volume_server_grpc.pb.gois excluded by!**/*.pb.goweed/pb/worker_pb/worker.pb.gois excluded by!**/*.pb.goweed/pb/worker_pb/worker_grpc.pb.gois excluded by!**/*.pb.goweed/util/skiplist/skiplist.pb.gois excluded by!**/*.pb.go
📒 Files selected for processing (249)
other/mq_client_example/agent_pub_record/agent_pub_record.goother/mq_client_example/agent_sub_record/agent_sub_record.goseaweedfs-rdma-sidecar/pkg/rdma/client.goseaweedfs-rdma-sidecar/pkg/seaweedfs/client.gotest/fuse_integration/framework.gotest/fuse_integration/minimal_test.gotest/kafka/integration/rebalancing_test.gotest/kafka/integration/schema_end_to_end_test.gotest/kafka/kafka-client-loadtest/internal/consumer/consumer_stalling_test.gotest/kafka/loadtest/resume_million_test.gotest/kafka/unit/gateway_test.gotest/s3/etag/s3_etag_test.gotest/s3/iam/s3_iam_integration_test.gotest/s3/s3client/s3client.gotest/s3/sse/github_7562_copy_test.gotest/s3/versioning/s3_versioning_multipart_test.gotest/s3/versioning/s3_versioning_pagination_stress_test.gotest/sftp/basic_test.gotest/sftp/framework.gounmaintained/load_test/load_test_meta_tail/load_test_meta_tail.gounmaintained/repeated_vacuum/repeated_vacuum.gounmaintained/s3/presigned_put/presigned_put.gounmaintained/stress_filer_upload/bench_filer_upload/bench_filer_upload.gounmaintained/stress_filer_upload/stress_filer_upload_actual/stress_filer_upload.gounmaintained/volume_tailer/volume_tailer.goweed/cluster/cluster_test.goweed/cluster/group_members.goweed/cluster/lock_manager/distributed_lock_manager.goweed/cluster/lock_manager/lock_manager.goweed/command/autocomplete.goweed/command/benchmark.goweed/command/filer_meta_tail.goweed/command/filer_meta_tail_elastic.goweed/command/filer_remote_gateway.goweed/command/filer_remote_gateway_buckets.goweed/command/filer_remote_sync.goweed/command/filer_sync_jobs.goweed/command/mini.goweed/command/mount_linux.goweed/command/sftp.goweed/command/shell.goweed/command/update.goweed/command/version.goweed/credential/filer_etc/filer_etc_identity.goweed/credential/filer_etc/filer_etc_policy.goweed/credential/filer_etc/filer_etc_store.goweed/filer/abstract_sql/abstract_sql_store_kv.goweed/filer/arangodb/arangodb_store_bucket.goweed/filer/cassandra/cassandra_store_kv.goweed/filer/cassandra2/cassandra_store_kv.goweed/filer/configuration.goweed/filer/empty_folder_cleanup/cleanup_queue.goweed/filer/empty_folder_cleanup/cleanup_queue_test.goweed/filer/empty_folder_cleanup/empty_folder_cleaner.goweed/filer/empty_folder_cleanup/empty_folder_cleaner_test.goweed/filer/entry.goweed/filer/etcd/etcd_store_kv.goweed/filer/etcd/etcd_store_test.goweed/filer/filechunk_section_test.goweed/filer/filechunks.goweed/filer/filechunks2_test.goweed/filer/filechunks_read.goweed/filer/filechunks_read_test.goweed/filer/filerstore_wrapper.goweed/filer/hbase/hbase_store_kv.goweed/filer/interval_list_test.goweed/filer/leveldb/leveldb_store_kv.goweed/filer/leveldb/leveldb_store_test.goweed/filer/leveldb2/leveldb2_store_test.goweed/filer/leveldb3/leveldb3_store_bucket.goweed/filer/leveldb3/leveldb3_store_test.goweed/filer/mysql/mysql_store.goweed/filer/read_remote.goweed/filer/reader_cache_test.goweed/filer/redis2/redis_sentinel_store.goweed/filer/redis3/kv_directory_children_test.goweed/filer/redis3/skiplist_element_store.goweed/filer/redis_lua/redis_sentinel_store.goweed/filer/redis_lua/stored_procedure/init.goweed/filer/remote_mapping.goweed/filer/remote_storage.goweed/filer/remote_storage_test.goweed/filer/ydb/ydb_store_kv.goweed/filer/ydb/ydb_store_test.goweed/filer/ydb/ydb_types.goweed/glog/glog_file.goweed/iam/sts/constants.goweed/iam/sts/sts_service_test.goweed/iam/utils/arn_utils_test.goweed/images/orientation_test.goweed/images/resizing_test.goweed/mount/inode_to_path_test.goweed/mount/locked_entry.goweed/mount/meta_cache/meta_cache.goweed/mount/meta_cache/meta_cache_subscribe.goweed/mount/page_writer/chunk_interval_list_test.goweed/mount/weedfs_forget.goweed/mount/weedfs_grpc_server.goweed/mount/weedfs_quota_test.goweed/mount/weedfs_stats.goweed/mq/agent/agent_grpc_pub_session.goweed/mq/agent/agent_grpc_publish.goweed/mq/agent/agent_server.goweed/mq/broker/broker_grpc_admin.goweed/mq/broker/broker_grpc_balance.goweed/mq/broker/broker_grpc_topic_partition_control.goweed/mq/client/agent_client/publish_session.goweed/mq/client/pub_client/publish.goweed/mq/client/pub_client/publisher.goweed/mq/pub_balancer/allocate_test.goweed/mq/pub_balancer/balance_action.goweed/mq/pub_balancer/balance_brokers_test.goweed/mq/pub_balancer/broker_stats.goweed/mq/pub_balancer/lookup.goweed/mq/pub_balancer/repair_test.goweed/mq/schema/schema_test.goweed/mq/schema/struct_to_schema_test.goweed/mq/schema/to_parquet_levels.goweed/mq/schema/to_parquet_levels_test.goweed/mq/segment/message_serde_test.goweed/mq/sub_coordinator/consumer_group.goweed/mq/sub_coordinator/inflight_message_tracker_test.goweed/mq/sub_coordinator/market.goweed/mq/sub_coordinator/partition_consumer_mapping.goweed/mq/sub_coordinator/partition_consumer_mapping_test.goweed/notification/gocdk_pub_sub/gocdk_pub_sub.goweed/operation/assign_file_id.goweed/operation/assign_file_id_test.goweed/operation/buffer_pool.goweed/operation/submit.goweed/operation/sync_volume.goweed/pb/filer_pb/filer_client_bfs.goweed/pb/filer_pb_tail.goweed/pb/mq_agent_pb/publish_response_test.goweed/pb/schema_pb/offset_test.goweed/pb/server_discovery.goweed/remote_storage/remote_storage.goweed/remote_storage/s3/aliyun.goweed/remote_storage/s3/backblaze.goweed/remote_storage/s3/filebase.goweed/remote_storage/s3/s3_storage_client.goweed/remote_storage/s3/storj.goweed/remote_storage/s3/tencent.goweed/remote_storage/s3/wasabi.goweed/remote_storage/track_sync_offset.goweed/replication/replicator.goweed/replication/sink/b2sink/b2_sink.goweed/replication/sink/filersink/filer_sink.goweed/replication/sink/localsink/local_sink.goweed/replication/sink/s3sink/s3_sink.goweed/replication/sub/notification_gocdk_pub_sub.goweed/s3api/bucket_metadata_test.goweed/s3api/filer_multipart_test.goweed/s3api/filer_util_tags.goweed/s3api/policy/post-policy.goweed/s3api/s3_constants/buckets.goweed/s3api/s3_constants/extend_key.goweed/s3api/s3_existing_object_tag_test.goweed/s3api/s3api_acl_helper_test.goweed/s3api/s3api_acp.goweed/s3api/s3api_bucket_handlers_object_lock_config.goweed/s3api/s3api_circuit_breaker.goweed/s3api/s3api_circuit_breaker_test.goweed/s3api/s3api_encrypted_volume_copy_test.goweed/s3api/s3api_handlers.goweed/s3api/s3api_list_normalization_test.goweed/s3api/s3api_server_grpc.goweed/s3api/s3api_status_handlers.goweed/s3api/s3api_streaming_copy.goweed/s3api/s3api_test.goweed/s3api/s3api_version_id_test.goweed/s3api/s3bucket/s3api_bucket_test.goweed/sequence/snowflake_sequencer_test.goweed/server/filer_grpc_server_admin.goweed/server/filer_grpc_server_kv.goweed/server/filer_grpc_server_traverse_meta_test.goweed/server/filer_server_handlers.goweed/server/filer_server_handlers_read_dir.goweed/server/filer_ui/templates.goweed/server/master_grpc_server_admin.goweed/server/master_grpc_server_cluster.goweed/server/raft_server_handlers.goweed/server/volume_grpc_copy.goweed/server/volume_grpc_read_all.goweed/server/volume_grpc_read_write.goweed/server/volume_grpc_remote.goweed/server/wrapped_webdav_fs.goweed/shell/command_cluster_check.goweed/shell/command_cluster_ps.goweed/shell/command_cluster_raft_add.goweed/shell/command_cluster_raft_leader_transfer.goweed/shell/command_cluster_raft_leader_transfer_test.goweed/shell/command_cluster_raft_ps.goweed/shell/command_cluster_raft_remove.goweed/shell/command_collection_list.goweed/shell/command_fs_log.goweed/shell/command_fs_verify.goweed/shell/command_lock_unlock.goweed/shell/command_mq_balance.goweed/shell/command_mq_topic_configure.goweed/shell/command_mq_topic_desc.goweed/shell/command_mq_topic_list.goweed/shell/command_remote_meta_sync.goweed/shell/command_remote_mount.goweed/shell/command_remote_mount_buckets.goweed/shell/command_remote_unmount.goweed/shell/command_volume_copy.goweed/shell/command_volume_delete.goweed/shell/command_volume_grow.goweed/shell/command_volume_mount.goweed/shell/command_volume_replica_check_test.goweed/shell/command_volume_unmount.goweed/stats/disk_windows.goweed/stats/metrics_buildinfo_test.goweed/storage/backend/backend.goweed/storage/backend/disk_file.goweed/storage/backend/memory_map/os_overloads/file_windows.goweed/storage/backend/rclone_backend/rclone_backend.goweed/storage/backend/s3_backend/s3_sessions.goweed/storage/backend/s3_backend/s3_upload.goweed/storage/disk_location_test.goweed/storage/erasure_coding/distribution/analysis.goweed/storage/erasure_coding/distribution/distribution.goweed/storage/erasure_coding/distribution/rebalancer.goweed/storage/erasure_coding/ec_test.goweed/storage/erasure_coding/placement/placement_test.goweed/storage/needle/file_id_test.goweed/storage/types/needle_id_type.goweed/storage/volume_checking.goweed/storage/volume_info/volume_info.goweed/topology/cluster_commands.goweed/topology/collection.goweed/topology/store_replicate.goweed/topology/topology_info.goweed/util/chunk_cache/chunk_cache_in_memory.goweed/util/chunk_cache/on_disk_cache_layer.goweed/util/file_util.goweed/util/grace/signal_handling.goweed/util/http/client/http_client.goweed/util/inits_test.goweed/util/limited_async_pool_test.goweed/util/log_buffer/log_read.goweed/util/mem/slot_pool_test.goweed/util/minfreespace.goweed/util/queue_test.goweed/util/skiplist/name_batch.goweed/wdclient/masterclient_test.goweed/wdclient/net2/managed_connection.goweed/wdclient/vid_map_test.go
💤 Files with no reviewable changes (19)
- weed/s3api/s3api_version_id_test.go
- weed/wdclient/masterclient_test.go
- weed/filer/empty_folder_cleanup/cleanup_queue_test.go
- weed/s3api/s3_constants/buckets.go
- weed/shell/command_volume_replica_check_test.go
- weed/s3api/s3api_encrypted_volume_copy_test.go
- weed/storage/erasure_coding/distribution/distribution.go
- weed/filer/empty_folder_cleanup/empty_folder_cleaner_test.go
- weed/shell/command_cluster_raft_leader_transfer.go
- test/sftp/framework.go
- weed/mount/weedfs_quota_test.go
- weed/filer/empty_folder_cleanup/cleanup_queue.go
- test/kafka/loadtest/resume_million_test.go
- weed/s3api/s3_existing_object_tag_test.go
- weed/filer/empty_folder_cleanup/empty_folder_cleaner.go
- test/s3/versioning/s3_versioning_multipart_test.go
- weed/shell/command_cluster_raft_leader_transfer_test.go
- test/s3/sse/github_7562_copy_test.go
- test/s3/versioning/s3_versioning_pagination_stress_test.go
| sb.WriteString(" export AWS_ACCESS_KEY_ID=your-access-key\\n") | ||
| sb.WriteString(" export AWS_SECRET_ACCESS_KEY=your-secret-key\\n") | ||
| sb.WriteString(" weed mini -dir=/data\\n") | ||
| sb.WriteString(" This will create initial credentials for the 'mini' user.\\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check the actual content at lines 1168-1171 with multiple verification methods
echo "=== Method 1: Direct cat with visible special chars ==="
sed -n '1168,1171p' weed/command/mini.go | cat -A
echo -e "\n=== Method 2: Hexdump to see raw bytes ==="
sed -n '1168,1171p' weed/command/mini.go | xxd
echo -e "\n=== Method 3: Direct output ==="
sed -n '1168,1171p' weed/command/mini.go
echo -e "\n=== Method 4: Check context around these lines ==="
sed -n '1165,1175p' weed/command/mini.goRepository: admin-coderabbit/seaweedfs
Length of output: 1364
Fix string escape sequences in welcome message output.
Lines 1168-1171 contain \\n in string literals, which will print as literal backslash-n characters instead of newlines. Compare with line 1167 above, which correctly uses \n for actual newlines. This causes the welcome message to display incorrectly to users:
export AWS_ACCESS_KEY_ID=your-access-key\n
export AWS_SECRET_ACCESS_KEY=your-secret-key\n
weed mini -dir=/data\n
This will create initial credentials for the 'mini' user.\n
instead of properly formatted lines. Change \\n to \n in these four sb.WriteString() calls.
🤖 Prompt for AI Agents
In @weed/command/mini.go around lines 1168 - 1171, The welcome message uses
escaped backslash-n sequences so the output shows "\n" literally; update the
four sb.WriteString calls that currently contain "\\n" (the lines writing "
export AWS_ACCESS_KEY_ID=your-access-key\\n", " export
AWS_SECRET_ACCESS_KEY=your-secret-key\\n", " weed mini -dir=/data\\n", and "
This will create initial credentials for the 'mini' user.\\n") to use real
newline escapes ("\n") so sb.WriteString writes actual newlines instead of
literal backslash-n characters.
| "github.com/go-sql-driver/mysql" | ||
| _ "github.com/go-sql-driver/mysql" | ||
| "github.com/seaweedfs/seaweedfs/weed/filer" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cat -n weed/filer/mysql/mysql_store.go | head -120Repository: admin-coderabbit/seaweedfs
Length of output: 4327
🏁 Script executed:
git log --oneline -1 weed/filer/mysql/mysql_store.goRepository: admin-coderabbit/seaweedfs
Length of output: 92
🏁 Script executed:
git show HEAD:weed/filer/mysql/mysql_store.go | head -20Repository: admin-coderabbit/seaweedfs
Length of output: 473
🏁 Script executed:
git show HEAD~1:weed/filer/mysql/mysql_store.go | head -20Repository: admin-coderabbit/seaweedfs
Length of output: 106
🏁 Script executed:
git diff HEAD~1 weed/filer/mysql/mysql_store.go 2>/dev/null || git show HEAD:weed/filer/mysql/mysql_store.go | head -20Repository: admin-coderabbit/seaweedfs
Length of output: 473
🏁 Script executed:
git log --all --oneline | head -5Repository: admin-coderabbit/seaweedfs
Length of output: 371
🏁 Script executed:
git rev-parse HEADRepository: admin-coderabbit/seaweedfs
Length of output: 110
🏁 Script executed:
git log --all --pretty=format:"%H %s" weed/filer/mysql/mysql_store.go | head -10Repository: admin-coderabbit/seaweedfs
Length of output: 234
🏁 Script executed:
git show d15f32ae:weed/filer/mysql/mysql_store.go | head -20Repository: admin-coderabbit/seaweedfs
Length of output: 400
Remove redundant underscore import of mysql package.
The import block contains two imports of the same package:
- Line 12:
"github.com/go-sql-driver/mysql"(regular import) - Line 13:
_ "github.com/go-sql-driver/mysql"(underscore/side-effects-only import)
However, the code directly uses functions from this package at lines 90 and 106 (mysql.RegisterTLSConfig() and mysql.ParseDSN()). This means the underscore import is redundant—only the regular import is needed. The underscore import form is intended for packages where you only rely on init-time side effects without calling any exported functions.
🔧 Proposed fix: remove the redundant underscore import
import (
"crypto/tls"
"crypto/x509"
"database/sql"
"fmt"
"os"
"strings"
"time"
"github.com/go-sql-driver/mysql"
- _ "github.com/go-sql-driver/mysql"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/filer/abstract_sql"
"github.com/seaweedfs/seaweedfs/weed/util"
)Note: This redundant import existed in the codebase before this PR. While goimports reorganized the imports, it did not remove this redundancy.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "github.com/go-sql-driver/mysql" | |
| _ "github.com/go-sql-driver/mysql" | |
| "github.com/seaweedfs/seaweedfs/weed/filer" | |
| "github.com/go-sql-driver/mysql" | |
| "github.com/seaweedfs/seaweedfs/weed/filer" |
🤖 Prompt for AI Agents
In @weed/filer/mysql/mysql_store.go around lines 12 - 14, The import block
redundantly imports "github.com/go-sql-driver/mysql" twice (once regular and
once as a side-effect-only `_` import) even though the code calls
mysql.RegisterTLSConfig and mysql.ParseDSN; remove the `_
"github.com/go-sql-driver/mysql"` entry so only the regular import remains,
ensuring calls to mysql.RegisterTLSConfig and mysql.ParseDSN still resolve and
no side-effect import duplicates exist.
What problem are we solving?
execute goimports to format the code
How are we solving the problem?
How is the PR tested?
Checks
Summary by CodeRabbit
Chores
Internal Improvements
✏️ Tip: You can customize this high-level summary in your review settings.