diff --git a/cmd/tools/migration/meta/210_to_220.go b/cmd/tools/migration/meta/210_to_220.go index 1fceb29d0e083..9b76324dd8ebf 100644 --- a/cmd/tools/migration/meta/210_to_220.go +++ b/cmd/tools/migration/meta/210_to_220.go @@ -59,7 +59,7 @@ func getLatestFieldIndexes(colls map[Timestamp]*pb.CollectionInfo) *FieldIndexes coll *pb.CollectionInfo } l := len(colls) - pairs := make([]pair, l) + pairs := make([]pair, 0, l) for ts, coll := range colls { pairs = append(pairs, pair{ts: ts, coll: coll}) } diff --git a/internal/rootcoord/broker.go b/internal/rootcoord/broker.go index 8701a5c6f2068..612eb58940491 100644 --- a/internal/rootcoord/broker.go +++ b/internal/rootcoord/broker.go @@ -237,7 +237,7 @@ func (b *ServerBroker) BroadcastAlteredCollection(ctx context.Context, req *milv return err } - partitionIDs := make([]int64, len(colMeta.Partitions)) + partitionIDs := make([]int64, 0, len(colMeta.Partitions)) for _, p := range colMeta.Partitions { partitionIDs = append(partitionIDs, p.PartitionID) } diff --git a/tests/integration/minicluster_v2.go b/tests/integration/minicluster_v2.go index 626cbbdafa81b..cf298582324d4 100644 --- a/tests/integration/minicluster_v2.go +++ b/tests/integration/minicluster_v2.go @@ -252,7 +252,7 @@ func StartMiniClusterV2(ctx context.Context, opts ...OptionV2) (*MiniClusterV2, } func (cluster *MiniClusterV2) AddQueryNodes(k int) []*grpcquerynode.Server { - servers := make([]*grpcquerynode.Server, k) + servers := make([]*grpcquerynode.Server, 0, k) for i := 0; i < k; i++ { servers = append(servers, cluster.AddQueryNode()) }