From 98fe24cdb7347b9b4ddfb1c8fe5e2025465d7692 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 29 Aug 2024 15:45:33 +0300 Subject: [PATCH] [#1343] go.mod: Update api-go Signed-off-by: Evgenii Stratonikov --- .../modules/control/shards_list.go | 6 +- cmd/frostfs-cli/modules/tree/add.go | 6 +- cmd/frostfs-cli/modules/tree/move.go | 2 +- go.mod | 2 +- go.sum | 4 +- pkg/services/control/server/list_shards.go | 10 +- pkg/services/control/server/policy_engine.go | 4 +- .../control/server/seal_writecache.go | 4 +- pkg/services/control/service_frostfs.pb.go | 66 +++---- pkg/services/control/types_frostfs.pb.go | 86 ++++----- pkg/services/tree/service.go | 22 +-- pkg/services/tree/service_frostfs.pb.go | 172 ++++++++---------- pkg/services/tree/signature_test.go | 2 +- 13 files changed, 180 insertions(+), 206 deletions(-) diff --git a/cmd/frostfs-cli/modules/control/shards_list.go b/cmd/frostfs-cli/modules/control/shards_list.go index 07c5bcd9a..e9e49bb29 100644 --- a/cmd/frostfs-cli/modules/control/shards_list.go +++ b/cmd/frostfs-cli/modules/control/shards_list.go @@ -61,7 +61,7 @@ func listShards(cmd *cobra.Command, _ []string) { } } -func prettyPrintShardsJSON(cmd *cobra.Command, ii []*control.ShardInfo) { +func prettyPrintShardsJSON(cmd *cobra.Command, ii []control.ShardInfo) { out := make([]map[string]any, 0, len(ii)) for _, i := range ii { out = append(out, map[string]any{ @@ -83,7 +83,7 @@ func prettyPrintShardsJSON(cmd *cobra.Command, ii []*control.ShardInfo) { cmd.Print(buf.String()) // pretty printer emits newline, so no need for Println } -func prettyPrintShards(cmd *cobra.Command, ii []*control.ShardInfo) { +func prettyPrintShards(cmd *cobra.Command, ii []control.ShardInfo) { for _, i := range ii { pathPrinter := func(name, path string) string { if path == "" { @@ -121,7 +121,7 @@ func shardModeToString(m control.ShardMode) string { return "unknown" } -func sortShardsByID(ii []*control.ShardInfo) { +func sortShardsByID(ii []control.ShardInfo) { sort.Slice(ii, func(i, j int) bool { return bytes.Compare(ii[i].GetShard_ID(), ii[j].GetShard_ID()) < 0 }) diff --git a/cmd/frostfs-cli/modules/tree/add.go b/cmd/frostfs-cli/modules/tree/add.go index 068b1d185..0b8dc292f 100644 --- a/cmd/frostfs-cli/modules/tree/add.go +++ b/cmd/frostfs-cli/modules/tree/add.go @@ -77,13 +77,13 @@ func add(cmd *cobra.Command, _ []string) { cmd.Println("Node ID: ", resp.GetBody().GetNodeId()) } -func parseMeta(cmd *cobra.Command) ([]*tree.KeyValue, error) { +func parseMeta(cmd *cobra.Command) ([]tree.KeyValue, error) { raws, _ := cmd.Flags().GetStringSlice(metaFlagKey) if len(raws) == 0 { return nil, nil } - pairs := make([]*tree.KeyValue, 0, len(raws)) + pairs := make([]tree.KeyValue, 0, len(raws)) for i := range raws { k, v, found := strings.Cut(raws[i], "=") if !found { @@ -94,7 +94,7 @@ func parseMeta(cmd *cobra.Command) ([]*tree.KeyValue, error) { pair.Key = k pair.Value = []byte(v) - pairs = append(pairs, &pair) + pairs = append(pairs, pair) } return pairs, nil diff --git a/cmd/frostfs-cli/modules/tree/move.go b/cmd/frostfs-cli/modules/tree/move.go index 95516940c..24abbd650 100644 --- a/cmd/frostfs-cli/modules/tree/move.go +++ b/cmd/frostfs-cli/modules/tree/move.go @@ -75,7 +75,7 @@ func move(cmd *cobra.Command, _ []string) { resp, err := cli.GetSubTree(ctx, subTreeReq) commonCmd.ExitOnErr(cmd, "rpc call: %w", err) - var meta []*tree.KeyValue + var meta []tree.KeyValue subtreeResp, err := resp.Recv() for ; err == nil; subtreeResp, err = resp.Recv() { meta = subtreeResp.GetBody().GetMeta() diff --git a/go.mod b/go.mod index b7f59c823..358370201 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22 require ( code.gitea.io/sdk/gitea v0.17.1 - git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240827104600-eba18f6e67ac + git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240828085308-5e1c6a908f61 git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 git.frostfs.info/TrueCloudLab/frostfs-locode-db v0.4.1-0.20240710074952-65761deb5c0d diff --git a/go.sum b/go.sum index d2f926151..be82bff70 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ code.gitea.io/sdk/gitea v0.17.1 h1:3jCPOG2ojbl8AcfaUCRYLT5MUcBMFwS0OSK2mA5Zok8= code.gitea.io/sdk/gitea v0.17.1/go.mod h1:aCnBqhHpoEWA180gMbaCtdX9Pl6BWBAuuP2miadoTNM= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240827104600-eba18f6e67ac h1:Gu3oiPnsSZPgwsUYs2f3xTQwndM/OWM/zo3zbN4rOb8= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240827104600-eba18f6e67ac/go.mod h1:BDnEpkKMykCS8u1nLzR6SgNzCv6885RWlo5TnravQuI= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240828085308-5e1c6a908f61 h1:bw9EVGWnfY9awFb5XYR52AGbzgg3o04gZF66yHob48c= +git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240828085308-5e1c6a908f61/go.mod h1:BDnEpkKMykCS8u1nLzR6SgNzCv6885RWlo5TnravQuI= git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e h1:kcBqZBiFIUBATUqEuvVigtkJJWQ2Gug/eYXn967o3M4= git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e/go.mod h1:F/fe1OoIDKr5Bz99q4sriuHDuf3aZefZy9ZsCqEtgxc= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= diff --git a/pkg/services/control/server/list_shards.go b/pkg/services/control/server/list_shards.go index b639245c1..56bd9fc1f 100644 --- a/pkg/services/control/server/list_shards.go +++ b/pkg/services/control/server/list_shards.go @@ -25,7 +25,7 @@ func (s *Server) ListShards(_ context.Context, req *control.ListShardsRequest) ( info := s.s.DumpInfo() - shardInfos := make([]*control.ShardInfo, 0, len(info.Shards)) + shardInfos := make([]control.ShardInfo, 0, len(info.Shards)) for _, sh := range info.Shards { si := new(control.ShardInfo) @@ -54,7 +54,7 @@ func (s *Server) ListShards(_ context.Context, req *control.ListShardsRequest) ( si.SetMode(m) si.SetErrorCount(sh.ErrorCount) - shardInfos = append(shardInfos, si) + shardInfos = append(shardInfos, *si) } body.SetShards(shardInfos) @@ -67,10 +67,10 @@ func (s *Server) ListShards(_ context.Context, req *control.ListShardsRequest) ( return resp, nil } -func blobstorInfoToProto(info blobstor.Info) []*control.BlobstorInfo { - res := make([]*control.BlobstorInfo, len(info.SubStorages)) +func blobstorInfoToProto(info blobstor.Info) []control.BlobstorInfo { + res := make([]control.BlobstorInfo, len(info.SubStorages)) for i := range info.SubStorages { - res[i] = &control.BlobstorInfo{ + res[i] = control.BlobstorInfo{ Path: info.SubStorages[i].Path, Type: info.SubStorages[i].Type, } diff --git a/pkg/services/control/server/policy_engine.go b/pkg/services/control/server/policy_engine.go index 98daac8a6..ab8258e27 100644 --- a/pkg/services/control/server/policy_engine.go +++ b/pkg/services/control/server/policy_engine.go @@ -220,13 +220,13 @@ func (s *Server) ListTargetsLocalOverrides(_ context.Context, req *control.ListT if err != nil { return nil, status.Error(getCodeByLocalStorageErr(err), err.Error()) } - targets := make([]*control.ChainTarget, 0, len(apeTargets)) + targets := make([]control.ChainTarget, 0, len(apeTargets)) for i := range apeTargets { target, err := controlTarget(&apeTargets[i]) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } - targets = append(targets, &target) + targets = append(targets, target) } resp := &control.ListTargetsLocalOverridesResponse{ diff --git a/pkg/services/control/server/seal_writecache.go b/pkg/services/control/server/seal_writecache.go index 1737677b7..6799bdcac 100644 --- a/pkg/services/control/server/seal_writecache.go +++ b/pkg/services/control/server/seal_writecache.go @@ -32,12 +32,12 @@ func (s *Server) SealWriteCache(ctx context.Context, req *control.SealWriteCache resp := &control.SealWriteCacheResponse{Body: &control.SealWriteCacheResponse_Body{}} for _, r := range res.ShardResults { if r.Success { - resp.Body.Results = append(resp.GetBody().GetResults(), &control.SealWriteCacheResponse_Body_Status{ + resp.Body.Results = append(resp.GetBody().GetResults(), control.SealWriteCacheResponse_Body_Status{ Shard_ID: *r.ShardID, Success: true, }) } else { - resp.Body.Results = append(resp.GetBody().GetResults(), &control.SealWriteCacheResponse_Body_Status{ + resp.Body.Results = append(resp.GetBody().GetResults(), control.SealWriteCacheResponse_Body_Status{ Shard_ID: *r.ShardID, Error: r.ErrorMsg, }) diff --git a/pkg/services/control/service_frostfs.pb.go b/pkg/services/control/service_frostfs.pb.go index a446c5e59..eb0d95c64 100644 --- a/pkg/services/control/service_frostfs.pb.go +++ b/pkg/services/control/service_frostfs.pb.go @@ -2851,7 +2851,7 @@ func (x *ListShardsRequest) UnmarshalEasyJSON(in *jlexer.Lexer) { } type ListShardsResponse_Body struct { - Shards []*ShardInfo `json:"shards"` + Shards []ShardInfo `json:"shards"` } var ( @@ -2869,7 +2869,7 @@ func (x *ListShardsResponse_Body) StableSize() (size int) { return 0 } for i := range x.Shards { - size += proto.NestedStructureSize(1, x.Shards[i]) + size += proto.NestedStructureSizeUnchecked(1, &x.Shards[i]) } return size } @@ -2888,9 +2888,7 @@ func (x *ListShardsResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { return } for i := range x.Shards { - if x.Shards[i] != nil { - x.Shards[i].EmitProtobuf(mm.AppendMessage(1)) - } + x.Shards[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -2908,8 +2906,8 @@ func (x *ListShardsResponse_Body) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Shards") } - x.Shards = append(x.Shards, new(ShardInfo)) - ff := x.Shards[len(x.Shards)-1] + x.Shards = append(x.Shards, ShardInfo{}) + ff := &x.Shards[len(x.Shards)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -2917,13 +2915,13 @@ func (x *ListShardsResponse_Body) UnmarshalProtobuf(src []byte) (err error) { } return nil } -func (x *ListShardsResponse_Body) GetShards() []*ShardInfo { +func (x *ListShardsResponse_Body) GetShards() []ShardInfo { if x != nil { return x.Shards } return nil } -func (x *ListShardsResponse_Body) SetShards(v []*ShardInfo) { +func (x *ListShardsResponse_Body) SetShards(v []ShardInfo) { x.Shards = v } @@ -2981,11 +2979,11 @@ func (x *ListShardsResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { switch key { case "shards": { - var f *ShardInfo - var list []*ShardInfo + var f ShardInfo + var list []ShardInfo in.Delim('[') for !in.IsDelim(']') { - f = new(ShardInfo) + f = ShardInfo{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -11870,7 +11868,7 @@ func (x *ListTargetsLocalOverridesRequest) UnmarshalEasyJSON(in *jlexer.Lexer) { } type ListTargetsLocalOverridesResponse_Body struct { - Targets []*ChainTarget `json:"targets"` + Targets []ChainTarget `json:"targets"` } var ( @@ -11888,7 +11886,7 @@ func (x *ListTargetsLocalOverridesResponse_Body) StableSize() (size int) { return 0 } for i := range x.Targets { - size += proto.NestedStructureSize(1, x.Targets[i]) + size += proto.NestedStructureSizeUnchecked(1, &x.Targets[i]) } return size } @@ -11907,9 +11905,7 @@ func (x *ListTargetsLocalOverridesResponse_Body) EmitProtobuf(mm *easyproto.Mess return } for i := range x.Targets { - if x.Targets[i] != nil { - x.Targets[i].EmitProtobuf(mm.AppendMessage(1)) - } + x.Targets[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -11927,8 +11923,8 @@ func (x *ListTargetsLocalOverridesResponse_Body) UnmarshalProtobuf(src []byte) ( if !ok { return fmt.Errorf("cannot unmarshal field %s", "Targets") } - x.Targets = append(x.Targets, new(ChainTarget)) - ff := x.Targets[len(x.Targets)-1] + x.Targets = append(x.Targets, ChainTarget{}) + ff := &x.Targets[len(x.Targets)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -11936,13 +11932,13 @@ func (x *ListTargetsLocalOverridesResponse_Body) UnmarshalProtobuf(src []byte) ( } return nil } -func (x *ListTargetsLocalOverridesResponse_Body) GetTargets() []*ChainTarget { +func (x *ListTargetsLocalOverridesResponse_Body) GetTargets() []ChainTarget { if x != nil { return x.Targets } return nil } -func (x *ListTargetsLocalOverridesResponse_Body) SetTargets(v []*ChainTarget) { +func (x *ListTargetsLocalOverridesResponse_Body) SetTargets(v []ChainTarget) { x.Targets = v } @@ -12000,11 +11996,11 @@ func (x *ListTargetsLocalOverridesResponse_Body) UnmarshalEasyJSON(in *jlexer.Le switch key { case "targets": { - var f *ChainTarget - var list []*ChainTarget + var f ChainTarget + var list []ChainTarget in.Delim('[') for !in.IsDelim(']') { - f = new(ChainTarget) + f = ChainTarget{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -14083,7 +14079,7 @@ func (x *SealWriteCacheResponse_Body_Status) UnmarshalEasyJSON(in *jlexer.Lexer) } type SealWriteCacheResponse_Body struct { - Results []*SealWriteCacheResponse_Body_Status `json:"results"` + Results []SealWriteCacheResponse_Body_Status `json:"results"` } var ( @@ -14101,7 +14097,7 @@ func (x *SealWriteCacheResponse_Body) StableSize() (size int) { return 0 } for i := range x.Results { - size += proto.NestedStructureSize(1, x.Results[i]) + size += proto.NestedStructureSizeUnchecked(1, &x.Results[i]) } return size } @@ -14120,9 +14116,7 @@ func (x *SealWriteCacheResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshale return } for i := range x.Results { - if x.Results[i] != nil { - x.Results[i].EmitProtobuf(mm.AppendMessage(1)) - } + x.Results[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -14140,8 +14134,8 @@ func (x *SealWriteCacheResponse_Body) UnmarshalProtobuf(src []byte) (err error) if !ok { return fmt.Errorf("cannot unmarshal field %s", "Results") } - x.Results = append(x.Results, new(SealWriteCacheResponse_Body_Status)) - ff := x.Results[len(x.Results)-1] + x.Results = append(x.Results, SealWriteCacheResponse_Body_Status{}) + ff := &x.Results[len(x.Results)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -14149,13 +14143,13 @@ func (x *SealWriteCacheResponse_Body) UnmarshalProtobuf(src []byte) (err error) } return nil } -func (x *SealWriteCacheResponse_Body) GetResults() []*SealWriteCacheResponse_Body_Status { +func (x *SealWriteCacheResponse_Body) GetResults() []SealWriteCacheResponse_Body_Status { if x != nil { return x.Results } return nil } -func (x *SealWriteCacheResponse_Body) SetResults(v []*SealWriteCacheResponse_Body_Status) { +func (x *SealWriteCacheResponse_Body) SetResults(v []SealWriteCacheResponse_Body_Status) { x.Results = v } @@ -14213,11 +14207,11 @@ func (x *SealWriteCacheResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { switch key { case "results": { - var f *SealWriteCacheResponse_Body_Status - var list []*SealWriteCacheResponse_Body_Status + var f SealWriteCacheResponse_Body_Status + var list []SealWriteCacheResponse_Body_Status in.Delim('[') for !in.IsDelim(']') { - f = new(SealWriteCacheResponse_Body_Status) + f = SealWriteCacheResponse_Body_Status{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/pkg/services/control/types_frostfs.pb.go b/pkg/services/control/types_frostfs.pb.go index 3cc37245f..42c1afa52 100644 --- a/pkg/services/control/types_frostfs.pb.go +++ b/pkg/services/control/types_frostfs.pb.go @@ -500,10 +500,10 @@ func (x *NodeInfo_Attribute) UnmarshalEasyJSON(in *jlexer.Lexer) { } type NodeInfo struct { - PublicKey []byte `json:"publicKey"` - Addresses []string `json:"addresses"` - Attributes []*NodeInfo_Attribute `json:"attributes"` - State NetmapStatus `json:"state"` + PublicKey []byte `json:"publicKey"` + Addresses []string `json:"addresses"` + Attributes []NodeInfo_Attribute `json:"attributes"` + State NetmapStatus `json:"state"` } var ( @@ -523,7 +523,7 @@ func (x *NodeInfo) StableSize() (size int) { size += proto.BytesSize(1, x.PublicKey) size += proto.RepeatedStringSize(2, x.Addresses) for i := range x.Attributes { - size += proto.NestedStructureSize(3, x.Attributes[i]) + size += proto.NestedStructureSizeUnchecked(3, &x.Attributes[i]) } size += proto.EnumSize(4, int32(x.State)) return size @@ -549,9 +549,7 @@ func (x *NodeInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendString(2, x.Addresses[j]) } for i := range x.Attributes { - if x.Attributes[i] != nil { - x.Attributes[i].EmitProtobuf(mm.AppendMessage(3)) - } + x.Attributes[i].EmitProtobuf(mm.AppendMessage(3)) } if int32(x.State) != 0 { mm.AppendInt32(4, int32(x.State)) @@ -584,8 +582,8 @@ func (x *NodeInfo) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Attributes") } - x.Attributes = append(x.Attributes, new(NodeInfo_Attribute)) - ff := x.Attributes[len(x.Attributes)-1] + x.Attributes = append(x.Attributes, NodeInfo_Attribute{}) + ff := &x.Attributes[len(x.Attributes)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -617,13 +615,13 @@ func (x *NodeInfo) GetAddresses() []string { func (x *NodeInfo) SetAddresses(v []string) { x.Addresses = v } -func (x *NodeInfo) GetAttributes() []*NodeInfo_Attribute { +func (x *NodeInfo) GetAttributes() []NodeInfo_Attribute { if x != nil { return x.Attributes } return nil } -func (x *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) { +func (x *NodeInfo) SetAttributes(v []NodeInfo_Attribute) { x.Attributes = v } func (x *NodeInfo) GetState() NetmapStatus { @@ -731,11 +729,11 @@ func (x *NodeInfo) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "attributes": { - var f *NodeInfo_Attribute - var list []*NodeInfo_Attribute + var f NodeInfo_Attribute + var list []NodeInfo_Attribute in.Delim('[') for !in.IsDelim(']') { - f = new(NodeInfo_Attribute) + f = NodeInfo_Attribute{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -775,8 +773,8 @@ func (x *NodeInfo) UnmarshalEasyJSON(in *jlexer.Lexer) { } type Netmap struct { - Epoch uint64 `json:"epoch"` - Nodes []*NodeInfo `json:"nodes"` + Epoch uint64 `json:"epoch"` + Nodes []NodeInfo `json:"nodes"` } var ( @@ -795,7 +793,7 @@ func (x *Netmap) StableSize() (size int) { } size += proto.UInt64Size(1, x.Epoch) for i := range x.Nodes { - size += proto.NestedStructureSize(2, x.Nodes[i]) + size += proto.NestedStructureSizeUnchecked(2, &x.Nodes[i]) } return size } @@ -817,9 +815,7 @@ func (x *Netmap) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint64(1, x.Epoch) } for i := range x.Nodes { - if x.Nodes[i] != nil { - x.Nodes[i].EmitProtobuf(mm.AppendMessage(2)) - } + x.Nodes[i].EmitProtobuf(mm.AppendMessage(2)) } } @@ -843,8 +839,8 @@ func (x *Netmap) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Nodes") } - x.Nodes = append(x.Nodes, new(NodeInfo)) - ff := x.Nodes[len(x.Nodes)-1] + x.Nodes = append(x.Nodes, NodeInfo{}) + ff := &x.Nodes[len(x.Nodes)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -861,13 +857,13 @@ func (x *Netmap) GetEpoch() uint64 { func (x *Netmap) SetEpoch(v uint64) { x.Epoch = v } -func (x *Netmap) GetNodes() []*NodeInfo { +func (x *Netmap) GetNodes() []NodeInfo { if x != nil { return x.Nodes } return nil } -func (x *Netmap) SetNodes(v []*NodeInfo) { +func (x *Netmap) SetNodes(v []NodeInfo) { x.Nodes = v } @@ -936,11 +932,11 @@ func (x *Netmap) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "nodes": { - var f *NodeInfo - var list []*NodeInfo + var f NodeInfo + var list []NodeInfo in.Delim('[') for !in.IsDelim(']') { - f = new(NodeInfo) + f = NodeInfo{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -958,13 +954,13 @@ func (x *Netmap) UnmarshalEasyJSON(in *jlexer.Lexer) { } type ShardInfo struct { - Shard_ID []byte `json:"shardID"` - MetabasePath string `json:"metabasePath"` - Blobstor []*BlobstorInfo `json:"blobstor"` - WritecachePath string `json:"writecachePath"` - Mode ShardMode `json:"mode"` - ErrorCount uint32 `json:"errorCount"` - PiloramaPath string `json:"piloramaPath"` + Shard_ID []byte `json:"shardID"` + MetabasePath string `json:"metabasePath"` + Blobstor []BlobstorInfo `json:"blobstor"` + WritecachePath string `json:"writecachePath"` + Mode ShardMode `json:"mode"` + ErrorCount uint32 `json:"errorCount"` + PiloramaPath string `json:"piloramaPath"` } var ( @@ -984,7 +980,7 @@ func (x *ShardInfo) StableSize() (size int) { size += proto.BytesSize(1, x.Shard_ID) size += proto.StringSize(2, x.MetabasePath) for i := range x.Blobstor { - size += proto.NestedStructureSize(3, x.Blobstor[i]) + size += proto.NestedStructureSizeUnchecked(3, &x.Blobstor[i]) } size += proto.StringSize(4, x.WritecachePath) size += proto.EnumSize(5, int32(x.Mode)) @@ -1013,9 +1009,7 @@ func (x *ShardInfo) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendString(2, x.MetabasePath) } for i := range x.Blobstor { - if x.Blobstor[i] != nil { - x.Blobstor[i].EmitProtobuf(mm.AppendMessage(3)) - } + x.Blobstor[i].EmitProtobuf(mm.AppendMessage(3)) } if len(x.WritecachePath) != 0 { mm.AppendString(4, x.WritecachePath) @@ -1057,8 +1051,8 @@ func (x *ShardInfo) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Blobstor") } - x.Blobstor = append(x.Blobstor, new(BlobstorInfo)) - ff := x.Blobstor[len(x.Blobstor)-1] + x.Blobstor = append(x.Blobstor, BlobstorInfo{}) + ff := &x.Blobstor[len(x.Blobstor)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -1108,13 +1102,13 @@ func (x *ShardInfo) GetMetabasePath() string { func (x *ShardInfo) SetMetabasePath(v string) { x.MetabasePath = v } -func (x *ShardInfo) GetBlobstor() []*BlobstorInfo { +func (x *ShardInfo) GetBlobstor() []BlobstorInfo { if x != nil { return x.Blobstor } return nil } -func (x *ShardInfo) SetBlobstor(v []*BlobstorInfo) { +func (x *ShardInfo) SetBlobstor(v []BlobstorInfo) { x.Blobstor = v } func (x *ShardInfo) GetWritecachePath() string { @@ -1250,11 +1244,11 @@ func (x *ShardInfo) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "blobstor": { - var f *BlobstorInfo - var list []*BlobstorInfo + var f BlobstorInfo + var list []BlobstorInfo in.Delim('[') for !in.IsDelim(']') { - f = new(BlobstorInfo) + f = BlobstorInfo{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/pkg/services/tree/service.go b/pkg/services/tree/service.go index 2012f53d2..4da61617f 100644 --- a/pkg/services/tree/service.go +++ b/pkg/services/tree/service.go @@ -360,7 +360,7 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest) return nil, err } - info := make([]*GetNodeByPathResponse_Info, 0, len(nodes)) + info := make([]GetNodeByPathResponse_Info, 0, len(nodes)) for _, node := range nodes { m, parent, err := s.forest.TreeGetMeta(ctx, cid, b.GetTreeId(), node) if err != nil { @@ -374,11 +374,11 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest) if b.GetAllAttributes() { x.Meta = metaToProto(m.Items) } else { - var metaValue []*KeyValue + var metaValue []KeyValue for _, kv := range m.Items { for _, attr := range b.GetAttributes() { if kv.Key == attr { - metaValue = append(metaValue, &KeyValue{ + metaValue = append(metaValue, KeyValue{ Key: kv.Key, Value: kv.Value, }) @@ -388,7 +388,7 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest) } x.Meta = metaValue } - info = append(info, &x) + info = append(info, x) } return &GetNodeByPathResponse{ @@ -782,21 +782,19 @@ func (s *Service) TreeList(ctx context.Context, req *TreeListRequest) (*TreeList }, nil } -func protoToMeta(arr []*KeyValue) []pilorama.KeyValue { +func protoToMeta(arr []KeyValue) []pilorama.KeyValue { meta := make([]pilorama.KeyValue, len(arr)) for i, kv := range arr { - if kv != nil { - meta[i].Key = kv.GetKey() - meta[i].Value = kv.GetValue() - } + meta[i].Key = kv.GetKey() + meta[i].Value = kv.GetValue() } return meta } -func metaToProto(arr []pilorama.KeyValue) []*KeyValue { - meta := make([]*KeyValue, len(arr)) +func metaToProto(arr []pilorama.KeyValue) []KeyValue { + meta := make([]KeyValue, len(arr)) for i, kv := range arr { - meta[i] = &KeyValue{ + meta[i] = KeyValue{ Key: kv.Key, Value: kv.Value, } diff --git a/pkg/services/tree/service_frostfs.pb.go b/pkg/services/tree/service_frostfs.pb.go index 3c6ba21b7..7b6abb1dd 100644 --- a/pkg/services/tree/service_frostfs.pb.go +++ b/pkg/services/tree/service_frostfs.pb.go @@ -16,11 +16,11 @@ import ( ) type AddRequest_Body struct { - ContainerId []byte `json:"containerId"` - TreeId string `json:"treeId"` - ParentId uint64 `json:"parentId"` - Meta []*KeyValue `json:"meta"` - BearerToken []byte `json:"bearerToken"` + ContainerId []byte `json:"containerId"` + TreeId string `json:"treeId"` + ParentId uint64 `json:"parentId"` + Meta []KeyValue `json:"meta"` + BearerToken []byte `json:"bearerToken"` } var ( @@ -41,7 +41,7 @@ func (x *AddRequest_Body) StableSize() (size int) { size += proto.StringSize(2, x.TreeId) size += proto.UInt64Size(3, x.ParentId) for i := range x.Meta { - size += proto.NestedStructureSize(4, x.Meta[i]) + size += proto.NestedStructureSizeUnchecked(4, &x.Meta[i]) } size += proto.BytesSize(5, x.BearerToken) return size @@ -70,9 +70,7 @@ func (x *AddRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint64(3, x.ParentId) } for i := range x.Meta { - if x.Meta[i] != nil { - x.Meta[i].EmitProtobuf(mm.AppendMessage(4)) - } + x.Meta[i].EmitProtobuf(mm.AppendMessage(4)) } if len(x.BearerToken) != 0 { mm.AppendBytes(5, x.BearerToken) @@ -111,8 +109,8 @@ func (x *AddRequest_Body) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Meta") } - x.Meta = append(x.Meta, new(KeyValue)) - ff := x.Meta[len(x.Meta)-1] + x.Meta = append(x.Meta, KeyValue{}) + ff := &x.Meta[len(x.Meta)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -153,13 +151,13 @@ func (x *AddRequest_Body) GetParentId() uint64 { func (x *AddRequest_Body) SetParentId(v uint64) { x.ParentId = v } -func (x *AddRequest_Body) GetMeta() []*KeyValue { +func (x *AddRequest_Body) GetMeta() []KeyValue { if x != nil { return x.Meta } return nil } -func (x *AddRequest_Body) SetMeta(v []*KeyValue) { +func (x *AddRequest_Body) SetMeta(v []KeyValue) { x.Meta = v } func (x *AddRequest_Body) GetBearerToken() []byte { @@ -264,11 +262,11 @@ func (x *AddRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "meta": { - var f *KeyValue - var list []*KeyValue + var f KeyValue + var list []KeyValue in.Delim('[') for !in.IsDelim(']') { - f = new(KeyValue) + f = KeyValue{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -793,12 +791,12 @@ func (x *AddResponse) UnmarshalEasyJSON(in *jlexer.Lexer) { } type AddByPathRequest_Body struct { - ContainerId []byte `json:"containerId"` - TreeId string `json:"treeId"` - PathAttribute string `json:"pathAttribute"` - Path []string `json:"path"` - Meta []*KeyValue `json:"meta"` - BearerToken []byte `json:"bearerToken"` + ContainerId []byte `json:"containerId"` + TreeId string `json:"treeId"` + PathAttribute string `json:"pathAttribute"` + Path []string `json:"path"` + Meta []KeyValue `json:"meta"` + BearerToken []byte `json:"bearerToken"` } var ( @@ -820,7 +818,7 @@ func (x *AddByPathRequest_Body) StableSize() (size int) { size += proto.StringSize(3, x.PathAttribute) size += proto.RepeatedStringSize(4, x.Path) for i := range x.Meta { - size += proto.NestedStructureSize(5, x.Meta[i]) + size += proto.NestedStructureSizeUnchecked(5, &x.Meta[i]) } size += proto.BytesSize(6, x.BearerToken) return size @@ -852,9 +850,7 @@ func (x *AddByPathRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendString(4, x.Path[j]) } for i := range x.Meta { - if x.Meta[i] != nil { - x.Meta[i].EmitProtobuf(mm.AppendMessage(5)) - } + x.Meta[i].EmitProtobuf(mm.AppendMessage(5)) } if len(x.BearerToken) != 0 { mm.AppendBytes(6, x.BearerToken) @@ -899,8 +895,8 @@ func (x *AddByPathRequest_Body) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Meta") } - x.Meta = append(x.Meta, new(KeyValue)) - ff := x.Meta[len(x.Meta)-1] + x.Meta = append(x.Meta, KeyValue{}) + ff := &x.Meta[len(x.Meta)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -950,13 +946,13 @@ func (x *AddByPathRequest_Body) GetPath() []string { func (x *AddByPathRequest_Body) SetPath(v []string) { x.Path = v } -func (x *AddByPathRequest_Body) GetMeta() []*KeyValue { +func (x *AddByPathRequest_Body) GetMeta() []KeyValue { if x != nil { return x.Meta } return nil } -func (x *AddByPathRequest_Body) SetMeta(v []*KeyValue) { +func (x *AddByPathRequest_Body) SetMeta(v []KeyValue) { x.Meta = v } func (x *AddByPathRequest_Body) GetBearerToken() []byte { @@ -1086,11 +1082,11 @@ func (x *AddByPathRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "meta": { - var f *KeyValue - var list []*KeyValue + var f KeyValue + var list []KeyValue in.Delim('[') for !in.IsDelim(']') { - f = new(KeyValue) + f = KeyValue{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -2351,12 +2347,12 @@ func (x *RemoveResponse) UnmarshalEasyJSON(in *jlexer.Lexer) { } type MoveRequest_Body struct { - ContainerId []byte `json:"containerId"` - TreeId string `json:"treeId"` - ParentId uint64 `json:"parentId"` - NodeId uint64 `json:"nodeId"` - Meta []*KeyValue `json:"meta"` - BearerToken []byte `json:"bearerToken"` + ContainerId []byte `json:"containerId"` + TreeId string `json:"treeId"` + ParentId uint64 `json:"parentId"` + NodeId uint64 `json:"nodeId"` + Meta []KeyValue `json:"meta"` + BearerToken []byte `json:"bearerToken"` } var ( @@ -2378,7 +2374,7 @@ func (x *MoveRequest_Body) StableSize() (size int) { size += proto.UInt64Size(3, x.ParentId) size += proto.UInt64Size(4, x.NodeId) for i := range x.Meta { - size += proto.NestedStructureSize(5, x.Meta[i]) + size += proto.NestedStructureSizeUnchecked(5, &x.Meta[i]) } size += proto.BytesSize(6, x.BearerToken) return size @@ -2410,9 +2406,7 @@ func (x *MoveRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint64(4, x.NodeId) } for i := range x.Meta { - if x.Meta[i] != nil { - x.Meta[i].EmitProtobuf(mm.AppendMessage(5)) - } + x.Meta[i].EmitProtobuf(mm.AppendMessage(5)) } if len(x.BearerToken) != 0 { mm.AppendBytes(6, x.BearerToken) @@ -2457,8 +2451,8 @@ func (x *MoveRequest_Body) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Meta") } - x.Meta = append(x.Meta, new(KeyValue)) - ff := x.Meta[len(x.Meta)-1] + x.Meta = append(x.Meta, KeyValue{}) + ff := &x.Meta[len(x.Meta)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -2508,13 +2502,13 @@ func (x *MoveRequest_Body) GetNodeId() uint64 { func (x *MoveRequest_Body) SetNodeId(v uint64) { x.NodeId = v } -func (x *MoveRequest_Body) GetMeta() []*KeyValue { +func (x *MoveRequest_Body) GetMeta() []KeyValue { if x != nil { return x.Meta } return nil } -func (x *MoveRequest_Body) SetMeta(v []*KeyValue) { +func (x *MoveRequest_Body) SetMeta(v []KeyValue) { x.Meta = v } func (x *MoveRequest_Body) GetBearerToken() []byte { @@ -2630,11 +2624,11 @@ func (x *MoveRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "meta": { - var f *KeyValue - var list []*KeyValue + var f KeyValue + var list []KeyValue in.Delim('[') for !in.IsDelim(']') { - f = new(KeyValue) + f = KeyValue{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -3685,10 +3679,10 @@ func (x *GetNodeByPathRequest) UnmarshalEasyJSON(in *jlexer.Lexer) { } type GetNodeByPathResponse_Info struct { - NodeId uint64 `json:"nodeId"` - Timestamp uint64 `json:"timestamp"` - Meta []*KeyValue `json:"meta"` - ParentId uint64 `json:"parentId"` + NodeId uint64 `json:"nodeId"` + Timestamp uint64 `json:"timestamp"` + Meta []KeyValue `json:"meta"` + ParentId uint64 `json:"parentId"` } var ( @@ -3708,7 +3702,7 @@ func (x *GetNodeByPathResponse_Info) StableSize() (size int) { size += proto.UInt64Size(1, x.NodeId) size += proto.UInt64Size(2, x.Timestamp) for i := range x.Meta { - size += proto.NestedStructureSize(3, x.Meta[i]) + size += proto.NestedStructureSizeUnchecked(3, &x.Meta[i]) } size += proto.UInt64Size(4, x.ParentId) return size @@ -3734,9 +3728,7 @@ func (x *GetNodeByPathResponse_Info) EmitProtobuf(mm *easyproto.MessageMarshaler mm.AppendUint64(2, x.Timestamp) } for i := range x.Meta { - if x.Meta[i] != nil { - x.Meta[i].EmitProtobuf(mm.AppendMessage(3)) - } + x.Meta[i].EmitProtobuf(mm.AppendMessage(3)) } if x.ParentId != 0 { mm.AppendUint64(4, x.ParentId) @@ -3769,8 +3761,8 @@ func (x *GetNodeByPathResponse_Info) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Meta") } - x.Meta = append(x.Meta, new(KeyValue)) - ff := x.Meta[len(x.Meta)-1] + x.Meta = append(x.Meta, KeyValue{}) + ff := &x.Meta[len(x.Meta)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -3802,13 +3794,13 @@ func (x *GetNodeByPathResponse_Info) GetTimestamp() uint64 { func (x *GetNodeByPathResponse_Info) SetTimestamp(v uint64) { x.Timestamp = v } -func (x *GetNodeByPathResponse_Info) GetMeta() []*KeyValue { +func (x *GetNodeByPathResponse_Info) GetMeta() []KeyValue { if x != nil { return x.Meta } return nil } -func (x *GetNodeByPathResponse_Info) SetMeta(v []*KeyValue) { +func (x *GetNodeByPathResponse_Info) SetMeta(v []KeyValue) { x.Meta = v } func (x *GetNodeByPathResponse_Info) GetParentId() uint64 { @@ -3902,11 +3894,11 @@ func (x *GetNodeByPathResponse_Info) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "meta": { - var f *KeyValue - var list []*KeyValue + var f KeyValue + var list []KeyValue in.Delim('[') for !in.IsDelim(']') { - f = new(KeyValue) + f = KeyValue{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -3930,7 +3922,7 @@ func (x *GetNodeByPathResponse_Info) UnmarshalEasyJSON(in *jlexer.Lexer) { } type GetNodeByPathResponse_Body struct { - Nodes []*GetNodeByPathResponse_Info `json:"nodes"` + Nodes []GetNodeByPathResponse_Info `json:"nodes"` } var ( @@ -3948,7 +3940,7 @@ func (x *GetNodeByPathResponse_Body) StableSize() (size int) { return 0 } for i := range x.Nodes { - size += proto.NestedStructureSize(1, x.Nodes[i]) + size += proto.NestedStructureSizeUnchecked(1, &x.Nodes[i]) } return size } @@ -3967,9 +3959,7 @@ func (x *GetNodeByPathResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler return } for i := range x.Nodes { - if x.Nodes[i] != nil { - x.Nodes[i].EmitProtobuf(mm.AppendMessage(1)) - } + x.Nodes[i].EmitProtobuf(mm.AppendMessage(1)) } } @@ -3987,8 +3977,8 @@ func (x *GetNodeByPathResponse_Body) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Nodes") } - x.Nodes = append(x.Nodes, new(GetNodeByPathResponse_Info)) - ff := x.Nodes[len(x.Nodes)-1] + x.Nodes = append(x.Nodes, GetNodeByPathResponse_Info{}) + ff := &x.Nodes[len(x.Nodes)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -3996,13 +3986,13 @@ func (x *GetNodeByPathResponse_Body) UnmarshalProtobuf(src []byte) (err error) { } return nil } -func (x *GetNodeByPathResponse_Body) GetNodes() []*GetNodeByPathResponse_Info { +func (x *GetNodeByPathResponse_Body) GetNodes() []GetNodeByPathResponse_Info { if x != nil { return x.Nodes } return nil } -func (x *GetNodeByPathResponse_Body) SetNodes(v []*GetNodeByPathResponse_Info) { +func (x *GetNodeByPathResponse_Body) SetNodes(v []GetNodeByPathResponse_Info) { x.Nodes = v } @@ -4060,11 +4050,11 @@ func (x *GetNodeByPathResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { switch key { case "nodes": { - var f *GetNodeByPathResponse_Info - var list []*GetNodeByPathResponse_Info + var f GetNodeByPathResponse_Info + var list []GetNodeByPathResponse_Info in.Delim('[') for !in.IsDelim(']') { - f = new(GetNodeByPathResponse_Info) + f = GetNodeByPathResponse_Info{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() @@ -4935,10 +4925,10 @@ func (x *GetSubTreeRequest) UnmarshalEasyJSON(in *jlexer.Lexer) { } type GetSubTreeResponse_Body struct { - NodeId []uint64 `json:"nodeId"` - ParentId []uint64 `json:"parentId"` - Timestamp []uint64 `json:"timestamp"` - Meta []*KeyValue `json:"meta"` + NodeId []uint64 `json:"nodeId"` + ParentId []uint64 `json:"parentId"` + Timestamp []uint64 `json:"timestamp"` + Meta []KeyValue `json:"meta"` } var ( @@ -4965,7 +4955,7 @@ func (x *GetSubTreeResponse_Body) StableSize() (size int) { size += protowire.SizeGroup(protowire.Number(3), protowire.SizeVarint(x.Timestamp[i])) } for i := range x.Meta { - size += proto.NestedStructureSize(4, x.Meta[i]) + size += proto.NestedStructureSizeUnchecked(4, &x.Meta[i]) } return size } @@ -4993,9 +4983,7 @@ func (x *GetSubTreeResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { mm.AppendUint64(3, x.Timestamp[j]) } for i := range x.Meta { - if x.Meta[i] != nil { - x.Meta[i].EmitProtobuf(mm.AppendMessage(4)) - } + x.Meta[i].EmitProtobuf(mm.AppendMessage(4)) } } @@ -5031,8 +5019,8 @@ func (x *GetSubTreeResponse_Body) UnmarshalProtobuf(src []byte) (err error) { if !ok { return fmt.Errorf("cannot unmarshal field %s", "Meta") } - x.Meta = append(x.Meta, new(KeyValue)) - ff := x.Meta[len(x.Meta)-1] + x.Meta = append(x.Meta, KeyValue{}) + ff := &x.Meta[len(x.Meta)-1] if err := ff.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -5067,13 +5055,13 @@ func (x *GetSubTreeResponse_Body) GetTimestamp() []uint64 { func (x *GetSubTreeResponse_Body) SetTimestamp(v []uint64) { x.Timestamp = v } -func (x *GetSubTreeResponse_Body) GetMeta() []*KeyValue { +func (x *GetSubTreeResponse_Body) GetMeta() []KeyValue { if x != nil { return x.Meta } return nil } -func (x *GetSubTreeResponse_Body) SetMeta(v []*KeyValue) { +func (x *GetSubTreeResponse_Body) SetMeta(v []KeyValue) { x.Meta = v } @@ -5206,11 +5194,11 @@ func (x *GetSubTreeResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { } case "meta": { - var f *KeyValue - var list []*KeyValue + var f KeyValue + var list []KeyValue in.Delim('[') for !in.IsDelim(']') { - f = new(KeyValue) + f = KeyValue{} f.UnmarshalEasyJSON(in) list = append(list, f) in.WantComma() diff --git a/pkg/services/tree/signature_test.go b/pkg/services/tree/signature_test.go index ce5039f7c..3c3ebfe89 100644 --- a/pkg/services/tree/signature_test.go +++ b/pkg/services/tree/signature_test.go @@ -123,7 +123,7 @@ func TestMessageSign(t *testing.T) { ContainerId: rawCID1, ParentId: 1, NodeId: 2, - Meta: []*KeyValue{ + Meta: []KeyValue{ {Key: "kkk", Value: []byte("vvv")}, }, },