From 2759ae437720cacc85fdbeb5e835efd793cb5b56 Mon Sep 17 00:00:00 2001 From: Rogger Vasquez Date: Thu, 8 Jun 2023 13:07:38 -0500 Subject: [PATCH] rpk: fix linter failures. --- src/go/rpk/pkg/cli/profile/prompt.go | 2 +- src/go/rpk/pkg/cli/topic/describe.go | 2 +- src/go/rpk/pkg/config/params.go | 8 ++++---- src/go/rpk/pkg/config/rpk_yaml.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/go/rpk/pkg/cli/profile/prompt.go b/src/go/rpk/pkg/cli/profile/prompt.go index fc08065b62fd..38172f54e649 100644 --- a/src/go/rpk/pkg/cli/profile/prompt.go +++ b/src/go/rpk/pkg/cli/profile/prompt.go @@ -84,7 +84,7 @@ Four modifiers are supported, "bold", "faint", "underline", and "invert". y, ok := cfg.ActualRpkYaml() if !ok { - errmsg = fmt.Sprintf("rpk.yaml file is missing or cannot be loaded") + errmsg = "rpk.yaml file is missing or cannot be loaded" return } p := y.Profile(y.CurrentProfile) diff --git a/src/go/rpk/pkg/cli/topic/describe.go b/src/go/rpk/pkg/cli/topic/describe.go index 315691a67b3f..ee3703014b1b 100644 --- a/src/go/rpk/pkg/cli/topic/describe.go +++ b/src/go/rpk/pkg/cli/topic/describe.go @@ -385,7 +385,7 @@ func listStartEndOffsets(cl *kgo.Client, topic string, numPartitions int, stable // Finally, the HWM. shards = cl.RequestSharded(context.Background(), req) - allFailed = kafka.EachShard(req, shards, func(shard kgo.ResponseShard) { + kafka.EachShard(req, shards, func(shard kgo.ResponseShard) { resp := shard.Resp.(*kmsg.ListOffsetsResponse) if len(resp.Topics) > 0 { for _, partition := range resp.Topics[0].Partitions { diff --git a/src/go/rpk/pkg/config/params.go b/src/go/rpk/pkg/config/params.go index 5e9c59c1e6a8..4b4d316c28df 100644 --- a/src/go/rpk/pkg/config/params.go +++ b/src/go/rpk/pkg/config/params.go @@ -829,11 +829,11 @@ func readFile(fs afero.Fs, path string) (string, []byte, error) { return abs, file, err } -func (p *Params) backcompatOldCloudYaml(fs afero.Fs) error { +func (*Params) backcompatOldCloudYaml(fs afero.Fs) error { def, err := DefaultRpkYamlPath() if err != nil { - // This error only happens if the user unset $HOME, and if they - // do that, we will avoid failing / avoid backcompat here. + //nolint:nilerr // This error only happens if the user unset $HOME, and + // if they do that, we will avoid failing / avoid backcompat here. return nil } @@ -913,7 +913,7 @@ func (p *Params) readRpkConfig(fs afero.Fs, c *Config) error { if p.ConfigFlag != "" { path = p.ConfigFlag } else if err != nil { - // If $HOME is unset, we do not read any file. If the user + //nolint:nilerr // If $HOME is unset, we do not read any file. If the user // eventually tries to write, we fail in Write. Allowing // $HOME to not exists allows rpk to work in CI settings // where all config flags are being specified. diff --git a/src/go/rpk/pkg/config/rpk_yaml.go b/src/go/rpk/pkg/config/rpk_yaml.go index dc6747ab0497..3418e16dcd88 100644 --- a/src/go/rpk/pkg/config/rpk_yaml.go +++ b/src/go/rpk/pkg/config/rpk_yaml.go @@ -323,4 +323,4 @@ func (d *Duration) UnmarshalText(text []byte) error { return err } -func (d *Duration) YamlTypeNameForTest() string { return "duration" } +func (*Duration) YamlTypeNameForTest() string { return "duration" }