From 636a1e9290a59b9da82f17f5cedace505eb2d049 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 12 Jan 2024 19:28:13 +0300 Subject: [PATCH] [#114] internal: Resolve linter issues Signed-off-by: Evgenii Stratonikov --- internal/datagen/generator.go | 2 +- internal/local/local.go | 6 ++++-- internal/native/client.go | 14 ++++++-------- internal/native/native.go | 6 +++--- internal/s3local/local.go | 5 ++++- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/internal/datagen/generator.go b/internal/datagen/generator.go index 845d7fd..33b4180 100644 --- a/internal/datagen/generator.go +++ b/internal/datagen/generator.go @@ -84,7 +84,7 @@ func (g *Generator) fillBuffer() { } g.buf = b.Bytes() default: - rand.Read(g.buf) // Per docs, err is always nil here + g.rand.Read(g.buf) // Per docs, err is always nil here } } diff --git a/internal/local/local.go b/internal/local/local.go index 6e207d2..788061d 100644 --- a/internal/local/local.go +++ b/internal/local/local.go @@ -248,7 +248,7 @@ func storageEngineOptionsFromConfig(c *config.Config, debug bool, l Limiter) ([] var shOpts [][]shard.Option - engineconfig.IterateShards(c, false, func(sc *shardconfig.Config) error { + err := engineconfig.IterateShards(c, false, func(sc *shardconfig.Config) error { opts := []shard.Option{ shard.WithRefillMetabase(sc.RefillMetabase()), shard.WithMode(sc.Mode()), @@ -375,7 +375,9 @@ func storageEngineOptionsFromConfig(c *config.Config, debug bool, l Limiter) ([] return nil }) - + if err != nil { + return nil, nil, fmt.Errorf("iterate shards: %w", err) + } return ngOpts, shOpts, nil } diff --git a/internal/native/client.go b/internal/native/client.go index 614886d..e6bc330 100644 --- a/internal/native/client.go +++ b/internal/native/client.go @@ -309,10 +309,9 @@ func (c *Client) PutContainer(params map[string]string) PutContainerResponse { } start := time.Now() - var prm client.PrmContainerPut - prm.SetContainer(cnr) - - res, err := c.cli.ContainerPut(c.vu.Context(), prm) + res, err := c.cli.ContainerPut(c.vu.Context(), client.PrmContainerPut{ + Container: &cnr, + }) if err != nil { return c.putCnrErrorResponse(err) } @@ -500,10 +499,9 @@ func (x *waitParams) setDefaults() { func (c *Client) waitForContainerPresence(ctx context.Context, cnrID cid.ID, wp *waitParams) error { return waitFor(ctx, wp, func(ctx context.Context) bool { - var prm client.PrmContainerGet - prm.SetContainer(cnrID) - - _, err := c.cli.ContainerGet(ctx, prm) + _, err := c.cli.ContainerGet(ctx, client.PrmContainerGet{ + ContainerID: &cnrID, + }) return err == nil }) } diff --git a/internal/native/native.go b/internal/native/native.go index 95a8e7d..ca02bbf 100644 --- a/internal/native/native.go +++ b/internal/native/native.go @@ -89,9 +89,9 @@ func (n *Native) Connect(endpoint, hexPrivateKey string, dialTimeout, streamTime // generate session token exp := uint64(math.MaxUint64) - var prmSessionCreate client.PrmSessionCreate - prmSessionCreate.SetExp(exp) - sessionResp, err := cli.SessionCreate(n.vu.Context(), prmSessionCreate) + sessionResp, err := cli.SessionCreate(n.vu.Context(), client.PrmSessionCreate{ + Expiration: exp, + }) if err != nil { return nil, fmt.Errorf("dial endpoint: %s %w", endpoint, err) } diff --git a/internal/s3local/local.go b/internal/s3local/local.go index e760fe7..3da7435 100644 --- a/internal/s3local/local.go +++ b/internal/s3local/local.go @@ -151,7 +151,10 @@ func (s *Local) Connect(configFile string, configDir string, params map[string]s } l := layer.NewLayer(zap.L(), &frostfs{rc}, cfg) - l.Initialize(s.l.VU().Context(), nopEventListener{}) + err = l.Initialize(s.l.VU().Context(), nopEventListener{}) + if err != nil { + return nil, fmt.Errorf("initialize: %w", err) + } return &Client{ vu: s.l.VU(),