From 4dbcde15991e6a63f3ab620cc01cf476d1fc98a6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:49:56 +0000 Subject: [PATCH] chore(deps): update golangci/golangci-lint docker tag to v1.56.1 Also fix unused-parameter errors, golangci-lint v1.56.1 started complaining about these. Signed-off-by: renovate[bot] Signed-off-by: Michi Mutsuzaki --- .github/workflows/go.yaml | 2 +- Makefile | 4 ++-- connectivity/suite.go | 36 ++++++++++++++++---------------- connectivity/tests/health.go | 2 +- internal/cli/cmd/bgp.go | 4 ++-- internal/cli/cmd/clustermesh.go | 26 +++++++++++------------ internal/cli/cmd/cmd.go | 2 +- internal/cli/cmd/config.go | 6 +++--- internal/cli/cmd/connectivity.go | 4 ++-- internal/cli/cmd/context.go | 2 +- internal/cli/cmd/encrypt.go | 6 +++--- internal/cli/cmd/hubble.go | 12 +++++------ internal/cli/cmd/install.go | 12 +++++------ internal/cli/cmd/status.go | 2 +- internal/cli/cmd/sysdump.go | 2 +- internal/cli/cmd/version.go | 2 +- internal/helm/helm.go | 2 +- k8s/client.go | 4 ++-- status/k8s.go | 2 +- sysdump/sysdump.go | 14 ++++++------- 20 files changed, 73 insertions(+), 73 deletions(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index c9137de3d6..afb6a7233c 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -29,7 +29,7 @@ jobs: uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0 with: # renovate: datasource=docker depName=golangci/golangci-lint - version: v1.55.2 + version: v1.56.1 args: --config=.golangci.yml --verbose skip-cache: true diff --git a/Makefile b/Makefile index 2f036b3c46..dc08f42bd0 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,8 @@ GO_IMAGE_VERSION = 1.22.0-alpine3.19 GO_IMAGE_SHA = sha256:8e96e6cff6a388c2f70f5f662b64120941fcd7d4b89d62fec87520323a316bd9 # renovate: datasource=docker depName=golangci/golangci-lint -GOLANGCILINT_WANT_VERSION = v1.55.2 -GOLANGCILINT_IMAGE_SHA = sha256:e699df940be1810b08ba6ec050bfc34cc1931027283b5a7f607fb6a67b503876 +GOLANGCILINT_WANT_VERSION = v1.56.1 +GOLANGCILINT_IMAGE_SHA = sha256:30faf70f689bfce7be639f79076c689db45df48549d43ad265ce965612a6bebf GOLANGCILINT_VERSION = $(shell golangci-lint version --format short 2>/dev/null) $(TARGET): diff --git a/connectivity/suite.go b/connectivity/suite.go index 840e87b133..805e6927c8 100644 --- a/connectivity/suite.go +++ b/connectivity/suite.go @@ -340,7 +340,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { WithScenarios( tests.PodToPod(), ). - WithExpectations(func(a *check.Action) (egress, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress, ingress check.Result) { return check.ResultOK.ExpectMetricsIncrease(ct.CiliumAgentMetrics(), "cilium_forward_count_total"), check.ResultOK.ExpectMetricsIncrease(ct.CiliumAgentMetrics(), "cilium_forward_count_total") }) @@ -402,7 +402,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { tests.PodToPod(), tests.PodToPodWithEndpoints(), ). - WithExpectations(func(a *check.Action) (egress, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress, ingress check.Result) { return check.ResultDefaultDenyEgressDrop, check.ResultNone }) @@ -412,7 +412,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { tests.PodToPod(), tests.PodToPodWithEndpoints(), ). - WithExpectations(func(a *check.Action) (egress, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress, ingress check.Result) { return check.ResultDefaultDenyEgressDrop, check.ResultNone }) @@ -422,7 +422,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { tests.PodToPod(), tests.PodToCIDR(), ). - WithExpectations(func(a *check.Action) (egress, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress, ingress check.Result) { return check.ResultPolicyDenyEgressDrop, check.ResultNone }) @@ -433,7 +433,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { // https://github.com/cilium/cilium/blob/88c4dddede2a3b5b9a7339c1316a0dedd7229a26/pkg/policy/api/entity.go#L126 tests.PodToPod(tests.WithDestinationLabelsOption(map[string]string{"name": "echo-same-node"})), ). - WithExpectations(func(a *check.Action) (egress, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress, ingress check.Result) { return check.ResultOK, check.ResultOK }) @@ -442,7 +442,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { WithScenarios( tests.PodToPod(tests.WithDestinationLabelsOption(map[string]string{"name": "echo-other-node"})), ). - WithExpectations(func(a *check.Action) (egress, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress, ingress check.Result) { return check.ResultDefaultDenyEgressDrop, check.ResultNone }) } @@ -452,7 +452,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { WithScenarios( tests.PodToHost(), ). - WithExpectations(func(a *check.Action) (egress, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress, ingress check.Result) { return check.ResultOK, check.ResultNone }) @@ -611,7 +611,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { WithScenarios( tests.FromCIDRToPod(), ). - WithExpectations(func(a *check.Action) (egress, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress, ingress check.Result) { return check.ResultOK, check.ResultNone }) } @@ -993,7 +993,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { WithScenarios( tests.PodToWorldWithTLSIntercept(), ). - WithExpectations(func(a *check.Action) (egress, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress, ingress check.Result) { return check.ResultDropCurlHTTPError, check.ResultNone }) @@ -1007,7 +1007,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { WithScenarios( tests.PodToWorldWithTLSIntercept("-H", "X-Very-Secret-Token: 42"), ). - WithExpectations(func(a *check.Action) (egress, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress, ingress check.Result) { return check.ResultOK, check.ResultNone }) @@ -1044,7 +1044,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { WithScenarios( tests.PodToPod(), ). - WithExpectations(func(a *check.Action) (egress, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress, ingress check.Result) { return check.ResultDropCurlTimeout, check.ResultDropAuthRequired }) @@ -1068,7 +1068,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { WithScenarios( tests.PodToIngress(), ). - WithExpectations(func(a *check.Action) (egress check.Result, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress check.Result, ingress check.Result) { return check.ResultDefaultDenyEgressDrop, check.ResultNone }) @@ -1078,7 +1078,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { WithScenarios( tests.PodToIngress(), ). - WithExpectations(func(a *check.Action) (egress check.Result, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress check.Result, ingress check.Result) { return check.ResultDefaultDenyEgressDrop, check.ResultNone }) @@ -1088,7 +1088,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { WithScenarios( tests.PodToIngress(), ). - WithExpectations(func(a *check.Action) (egress check.Result, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress check.Result, ingress check.Result) { return check.ResultDefaultDenyEgressDrop, check.ResultNone }) @@ -1116,7 +1116,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { WithScenarios( tests.OutsideToIngressService(), ). - WithExpectations(func(a *check.Action) (egress check.Result, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress check.Result, ingress check.Result) { return check.ResultDefaultDenyEgressDrop, check.ResultNone }) @@ -1128,7 +1128,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { WithScenarios( tests.OutsideToIngressService(), ). - WithExpectations(func(a *check.Action) (egress check.Result, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress check.Result, ingress check.Result) { return check.ResultDefaultDenyEgressDrop, check.ResultNone }) @@ -1140,7 +1140,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { WithScenarios( tests.OutsideToIngressService(), ). - WithExpectations(func(a *check.Action) (egress check.Result, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress check.Result, ingress check.Result) { return check.ResultDefaultDenyEgressDrop, check.ResultNone }) @@ -1151,7 +1151,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, extra Hooks) error { tests.PodToPod(), // connects to other Pods directly, no DNS tests.PodToWorld(), // resolves set domain-name defaults to one.one.one.one ). - WithExpectations(func(a *check.Action) (egress check.Result, ingress check.Result) { + WithExpectations(func(_ *check.Action) (egress check.Result, ingress check.Result) { return check.ResultDropCurlTimeout, check.ResultNone }) diff --git a/connectivity/tests/health.go b/connectivity/tests/health.go index fbc7c126d5..1337b825da 100644 --- a/connectivity/tests/health.go +++ b/connectivity/tests/health.go @@ -32,7 +32,7 @@ func (s *ciliumHealth) Name() string { func (s *ciliumHealth) Run(ctx context.Context, t *check.Test) { for name, pod := range t.Context().CiliumPods() { pod := pod - t.NewGenericAction(s, name).Run(func(a *check.Action) { + t.NewGenericAction(s, name).Run(func(_ *check.Action) { runHealthProbe(ctx, t, &pod) }) } diff --git a/internal/cli/cmd/bgp.go b/internal/cli/cmd/bgp.go index 6e41e4a077..9b2672782e 100644 --- a/internal/cli/cmd/bgp.go +++ b/internal/cli/cmd/bgp.go @@ -35,7 +35,7 @@ func newCmdBgpPeers() *cobra.Command { Aliases: []string{"neighbors"}, Short: "Lists BGP peering state", Long: "This command lists the BGP state from all nodes in the cluster - requires cilium >= v1.13.2", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.CiliumNamespace = namespace s := bgp.NewStatus(k8sClient, params) @@ -72,7 +72,7 @@ func newCmdBgpRoutes() *cobra.Command { Get IPv4 unicast routes advertised to a specific peer: cilium bgp routes advertised ipv4 unicast peer 10.0.0.1`, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, args []string) error { params.CiliumNamespace = namespace s := bgp.NewStatus(k8sClient, params) diff --git a/internal/cli/cmd/clustermesh.go b/internal/cli/cmd/clustermesh.go index 467239a081..46ab5faa5f 100644 --- a/internal/cli/cmd/clustermesh.go +++ b/internal/cli/cmd/clustermesh.go @@ -58,7 +58,7 @@ func newCmdClusterMeshEnable() *cobra.Command { Use: "enable", Short: "Enable ClusterMesh ability in a cluster", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace cm := clustermesh.NewK8sClusterMesh(k8sClient, params) @@ -88,7 +88,7 @@ func newCmdClusterMeshDisable() *cobra.Command { Use: "disable", Short: "Disable ClusterMesh ability in a cluster", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace cm := clustermesh.NewK8sClusterMesh(k8sClient, params) @@ -111,7 +111,7 @@ func newCmdClusterMeshConnect() *cobra.Command { Use: "connect", Short: "Connect to a remote cluster", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace cm := clustermesh.NewK8sClusterMesh(k8sClient, params) @@ -136,7 +136,7 @@ func newCmdClusterMeshDisconnect() *cobra.Command { Use: "disconnect", Short: "Disconnect from a remote cluster", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace cm := clustermesh.NewK8sClusterMesh(k8sClient, params) if err := cm.Disconnect(context.Background()); err != nil { @@ -160,7 +160,7 @@ func newCmdClusterMeshStatus() *cobra.Command { Use: "status", Short: "Show status of ClusterMesh", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace if params.Output == status.OutputJSON { @@ -227,7 +227,7 @@ func newCmdExternalWorkloadCreate() *cobra.Command { Use: "create ", Short: "Create new external workloads", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, args []string) error { params.Namespace = namespace if labels != "" { @@ -263,7 +263,7 @@ func newCmdExternalWorkloadDelete() *cobra.Command { Use: "delete ", Short: "Delete named external workloads", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, args []string) error { cm := clustermesh.NewK8sClusterMesh(k8sClient, params) if err := cm.DeleteExternalWorkload(context.Background(), args); err != nil { fatalf("Unable to remove external workloads: %s", err) @@ -286,7 +286,7 @@ func newCmdExternalWorkloadInstall() *cobra.Command { Use: "install [output-file]", Short: "Creates a shell script to install external workloads", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, args []string) error { params.Namespace = namespace cm := clustermesh.NewK8sClusterMesh(k8sClient, params) @@ -328,7 +328,7 @@ func newCmdExternalWorkloadStatus() *cobra.Command { Use: "status [name...]", Short: "Show status of external workloads", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, args []string) error { params.Namespace = namespace cm := clustermesh.NewK8sClusterMesh(k8sClient, params) @@ -353,7 +353,7 @@ func newCmdClusterMeshEnableWithHelm() *cobra.Command { Use: "enable", Short: "Enable ClusterMesh ability in a cluster using Helm", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace ctx := context.Background() if err := clustermesh.EnableWithHelm(ctx, k8sClient, params); err != nil { @@ -379,7 +379,7 @@ func newCmdClusterMeshDisableWithHelm() *cobra.Command { Use: "disable", Short: "Disable ClusterMesh ability in a cluster using Helm", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace ctx := context.Background() if err := clustermesh.DisableWithHelm(ctx, k8sClient, params); err != nil { @@ -401,7 +401,7 @@ func newCmdClusterMeshConnectWithHelm() *cobra.Command { Use: "connect", Short: "Connect to a remote cluster", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace cm := clustermesh.NewK8sClusterMesh(k8sClient, params) if err := cm.ConnectWithHelm(context.Background()); err != nil { @@ -424,7 +424,7 @@ func newCmdClusterMeshDisconnectWithHelm() *cobra.Command { cmd := &cobra.Command{ Use: "disconnect", Short: "Disconnect from a remote cluster", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { params.Namespace = namespace cm := clustermesh.NewK8sClusterMesh(k8sClient, params) if err := cm.DisconnectWithHelm(context.Background()); err != nil { diff --git a/internal/cli/cmd/cmd.go b/internal/cli/cmd/cmd.go index 0c38f5ac90..913a812a55 100644 --- a/internal/cli/cmd/cmd.go +++ b/internal/cli/cmd/cmd.go @@ -48,7 +48,7 @@ func NewCiliumCommand(hooks Hooks) *cobra.Command { k8sClient = c return nil }, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { cmd.Help() }, Use: "cilium", diff --git a/internal/cli/cmd/config.go b/internal/cli/cmd/config.go index 0920554c26..6b413a393f 100644 --- a/internal/cli/cmd/config.go +++ b/internal/cli/cmd/config.go @@ -38,7 +38,7 @@ func newCmdConfigView() *cobra.Command { Use: "view", Short: "View current configuration", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace check := config.NewK8sConfig(k8sClient, params) @@ -64,7 +64,7 @@ func newCmdConfigSet() *cobra.Command { Short: "Set a key/value pair in the configuration", Long: ``, Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, args []string) error { params.Namespace = namespace check := config.NewK8sConfig(k8sClient, params) @@ -89,7 +89,7 @@ func newCmdConfigDelete() *cobra.Command { Short: "Delete a key in the configuration", Long: ``, Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, args []string) error { params.Namespace = namespace check := config.NewK8sConfig(k8sClient, params) diff --git a/internal/cli/cmd/connectivity.go b/internal/cli/cmd/connectivity.go index f9e51f8f21..adc6941eb2 100644 --- a/internal/cli/cmd/connectivity.go +++ b/internal/cli/cmd/connectivity.go @@ -50,7 +50,7 @@ var params = check.Parameters{ var tests []string func RunE(hooks Hooks) func(cmd *cobra.Command, args []string) error { - return func(cmd *cobra.Command, args []string) error { + return func(cmd *cobra.Command, _ []string) error { params.CiliumNamespace = namespace for _, test := range tests { @@ -209,7 +209,7 @@ func newCmdConnectivityPerf(hooks Hooks) *cobra.Command { Use: "perf", Short: "Test network performance", Long: ``, - PreRun: func(cmd *cobra.Command, args []string) { + PreRun: func(_ *cobra.Command, _ []string) { // This is a bit of hack that allows us to override default values // of these parameters that are not visible in perf subcommand options // as we can't have different defaults specified in test and perf subcommands diff --git a/internal/cli/cmd/context.go b/internal/cli/cmd/context.go index 4615a95f6e..79a417c930 100644 --- a/internal/cli/cmd/context.go +++ b/internal/cli/cmd/context.go @@ -11,7 +11,7 @@ import ( func newCmdContext() *cobra.Command { cmd := &cobra.Command{ - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { if contextName == "" { contextName = k8sClient.RawConfig.CurrentContext } diff --git a/internal/cli/cmd/encrypt.go b/internal/cli/cmd/encrypt.go index abe4192a18..d7da733156 100644 --- a/internal/cli/cmd/encrypt.go +++ b/internal/cli/cmd/encrypt.go @@ -33,7 +33,7 @@ func newCmdEncryptStatus() *cobra.Command { Use: "status", Short: "Display encryption status", Long: "This command returns encryption status from all nodes in the cluster", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.CiliumNamespace = namespace s := encrypt.NewEncrypt(k8sClient, params) if err := s.GetEncryptStatus(context.Background()); err != nil { @@ -56,7 +56,7 @@ func newCmdIPsecRotateKey() *cobra.Command { Use: "rotate-key", Short: "Rotate IPsec key", Long: "This command rotates IPsec encryption key in the cluster", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.CiliumNamespace = namespace s := encrypt.NewEncrypt(k8sClient, params) if err := s.IPsecRotateKey(context.Background()); err != nil { @@ -76,7 +76,7 @@ func newCmdIPsecKeyStatus() *cobra.Command { Aliases: []string{"ks"}, Short: "Display IPsec key", Long: "This command displays IPsec encryption key", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.CiliumNamespace = namespace s := encrypt.NewEncrypt(k8sClient, params) if err := s.IPsecKeyStatus(context.Background()); err != nil { diff --git a/internal/cli/cmd/hubble.go b/internal/cli/cmd/hubble.go index d9f228df78..08b2abe99c 100644 --- a/internal/cli/cmd/hubble.go +++ b/internal/cli/cmd/hubble.go @@ -48,7 +48,7 @@ func newCmdHubbleEnable() *cobra.Command { Use: "enable", Short: "Enable Hubble observability", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace ctx := context.Background() h, err := hubble.NewK8sHubble(ctx, k8sClient, params) @@ -113,7 +113,7 @@ func newCmdHubbleDisable() *cobra.Command { Use: "disable", Short: "Disable Hubble observability", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace ctx := context.Background() @@ -144,7 +144,7 @@ func newCmdPortForwardCommand() *cobra.Command { Use: "port-forward", Short: "Forward the relay port to the local machine", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Context = contextName params.Namespace = namespace ctx := context.Background() @@ -171,7 +171,7 @@ func newCmdUI() *cobra.Command { cmd := &cobra.Command{ Use: "ui", Short: "Open the Hubble UI", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Context = contextName params.Namespace = namespace @@ -203,7 +203,7 @@ func newCmdHubbleEnableWithHelm() *cobra.Command { Use: "enable", Short: "Enable Hubble observability using Helm", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace ctx := context.Background() if err := hubble.EnableWithHelm(ctx, k8sClient, params); err != nil { @@ -226,7 +226,7 @@ func newCmdHubbleDisableWithHelm() *cobra.Command { Use: "disable", Short: "Disable Hubble observability using Helm", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace ctx := context.Background() if err := hubble.DisableWithHelm(ctx, k8sClient, params); err != nil { diff --git a/internal/cli/cmd/install.go b/internal/cli/cmd/install.go index 6f9c25448f..e7f0aa75f2 100644 --- a/internal/cli/cmd/install.go +++ b/internal/cli/cmd/install.go @@ -37,7 +37,7 @@ cilium install # name and ID to prepare for multi-cluster capabilties. cilium install --context kind-cluster1 --cluster-id 1 --cluster-name cluster1 `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { params.Namespace = namespace cmd.Flags().Visit(func(f *pflag.Flag) { @@ -130,7 +130,7 @@ func newCmdUninstall() *cobra.Command { Use: "uninstall", Short: "Uninstall Cilium", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace ctx := context.Background() @@ -191,7 +191,7 @@ cilium upgrade # Upgrade Cilium to a specific version cilium upgrade --version %s `, defaults.Version), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { params.Namespace = namespace installer, err := install.NewK8sInstaller(k8sClient, params) @@ -265,7 +265,7 @@ cilium install # name and ID to prepare for multi-cluster capabilities. cilium install --context kind-cluster1 --set cluster.id=1 --set cluster.name=cluster1 `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { params.Namespace = namespace // Don't log anything if it's a dry run so that the dry run output can easily be piped to other commands. if params.IsDryRun() { @@ -298,7 +298,7 @@ func newCmdUninstallWithHelm() *cobra.Command { Use: "uninstall", Short: "Uninstall Cilium using Helm", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace ctx := context.Background() @@ -343,7 +343,7 @@ cilium upgrade # to prepare for multi-cluster capabilities. cilium upgrade --set cluster.id=1 --set cluster.name=cluster1 `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { params.Namespace = namespace // Don't log anything if it's a dry run so that the dry run output can easily be piped to other commands. if params.IsDryRun() { diff --git a/internal/cli/cmd/status.go b/internal/cli/cmd/status.go index c0e5be8f39..693e62f8c6 100644 --- a/internal/cli/cmd/status.go +++ b/internal/cli/cmd/status.go @@ -23,7 +23,7 @@ func newCmdStatus() *cobra.Command { Use: "status", Short: "Display status", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { params.Namespace = namespace collector, err := status.NewK8sStatusCollector(k8sClient, params) diff --git a/internal/cli/cmd/sysdump.go b/internal/cli/cmd/sysdump.go index 16c5d2fd22..4d125e8222 100644 --- a/internal/cli/cmd/sysdump.go +++ b/internal/cli/cmd/sysdump.go @@ -28,7 +28,7 @@ func newCmdSysdump(hooks SysdumpHooks) *cobra.Command { Use: "sysdump", Short: "Collects information required to troubleshoot issues with Cilium and Hubble", Long: ``, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { // Honor --namespace global flag in case it is set and --cilium-namespace is not set if sysdumpOptions.CiliumNamespace == "" && cmd.Flags().Changed("namespace") { sysdumpOptions.CiliumNamespace = namespace diff --git a/internal/cli/cmd/version.go b/internal/cli/cmd/version.go index 960d48830d..b81c6821c4 100644 --- a/internal/cli/cmd/version.go +++ b/internal/cli/cmd/version.go @@ -37,7 +37,7 @@ func newCmdVersion() *cobra.Command { Use: "version", Short: "Display detailed version information", Long: `Displays information about the version of this software.`, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { fmt.Printf("cilium-cli: %s compiled with %v on %v/%v\n", version, runtime.Version(), runtime.GOOS, runtime.GOARCH) fmt.Printf("cilium image (default): %s\n", defaults.Version) fmt.Printf("cilium image (stable): %s\n", getLatestStableVersion()) diff --git a/internal/helm/helm.go b/internal/helm/helm.go index 65d18c6a13..020fbcf3e9 100644 --- a/internal/helm/helm.go +++ b/internal/helm/helm.go @@ -487,7 +487,7 @@ func GetCurrentRelease( // Use the default Helm driver (Kubernetes secret). helmDriver := "" actionConfig := action.Configuration{} - logger := func(format string, v ...interface{}) {} + logger := func(_ string, _ ...interface{}) {} if err := actionConfig.Init(k8sClient, namespace, helmDriver, logger); err != nil { return nil, err } diff --git a/k8s/client.go b/k8s/client.go index 59e3f06ab7..32607d9836 100644 --- a/k8s/client.go +++ b/k8s/client.go @@ -125,7 +125,7 @@ func NewClient(contextName, kubeconfig, ciliumNamespace string) (*Client, error) // Use the default Helm driver (Kubernetes secret). helmDriver := "" actionConfig := action.Configuration{} - logger := func(format string, v ...interface{}) {} + logger := func(_ string, _ ...interface{}) {} if err := actionConfig.Init(&restClientGetter, ciliumNamespace, helmDriver, logger); err != nil { return nil, err } @@ -1140,7 +1140,7 @@ func (c *Client) GetHelmValues(_ context.Context, releaseName string, namespace } helmDriver := "" actionConfig := action.Configuration{} - logger := func(format string, v ...interface{}) {} + logger := func(_ string, _ ...interface{}) {} if err := actionConfig.Init(c.RESTClientGetter, namespace, helmDriver, logger); err != nil { return "", err } diff --git a/status/k8s.go b/status/k8s.go index d3ce6db730..b0ced99bcc 100644 --- a/status/k8s.go +++ b/status/k8s.go @@ -528,7 +528,7 @@ func (k *K8sStatusCollector) status(ctx context.Context) *Status { // for the sake of sanity, don't get pod logs more than once var agentLogsOnce = sync.Once{} - err := k.podStatus(ctx, status, defaults.AgentDaemonSetName, defaults.AgentPodSelector, func(ctx context.Context, status *Status, name string, pod *corev1.Pod) { + err := k.podStatus(ctx, status, defaults.AgentDaemonSetName, defaults.AgentPodSelector, func(_ context.Context, status *Status, name string, pod *corev1.Pod) { if pod.Status.Phase == corev1.PodRunning { // extract container status var containerStatus *corev1.ContainerStatus diff --git a/sysdump/sysdump.go b/sysdump/sysdump.go index 3864132886..ab22b4a52c 100644 --- a/sysdump/sysdump.go +++ b/sysdump/sysdump.go @@ -744,7 +744,7 @@ func (c *Collector) Run() error { { Description: "Collecting the Cilium configuration", Quick: true, - Task: func(ctx context.Context) error { + Task: func(_ context.Context) error { if c.CiliumConfigMap == nil { return nil } @@ -968,7 +968,7 @@ func (c *Collector) Run() error { CreatesSubtasks: true, Description: "Collecting the CNI configuration files from Cilium pods", Quick: true, - Task: func(ctx context.Context) error { + Task: func(_ context.Context) error { if err := c.SubmitCniConflistSubtask(c.CiliumPods, ciliumAgentContainerName); err != nil { return fmt.Errorf("failed to collect CNI configuration files: %w", err) } @@ -997,7 +997,7 @@ func (c *Collector) Run() error { CreatesSubtasks: true, Description: "Collecting gops stats from Cilium pods", Quick: true, - Task: func(ctx context.Context) error { + Task: func(_ context.Context) error { if err := c.SubmitGopsSubtasks(c.CiliumPods, ciliumAgentContainerName); err != nil { return fmt.Errorf("failed to collect Cilium gops: %w", err) } @@ -1042,7 +1042,7 @@ func (c *Collector) Run() error { CreatesSubtasks: true, Description: "Collecting bugtool output from Cilium pods", Quick: false, - Task: func(ctx context.Context) error { + Task: func(_ context.Context) error { if err := c.submitCiliumBugtoolTasks(c.CiliumPods); err != nil { return fmt.Errorf("failed to collect 'cilium-bugtool': %w", err) } @@ -1053,7 +1053,7 @@ func (c *Collector) Run() error { CreatesSubtasks: true, Description: "Collecting profiling data from Cilium pods", Quick: false, - Task: func(ctx context.Context) error { + Task: func(_ context.Context) error { if !c.Options.Profiling { return nil } @@ -1067,7 +1067,7 @@ func (c *Collector) Run() error { CreatesSubtasks: true, Description: "Collecting logs from Cilium pods", Quick: false, - Task: func(ctx context.Context) error { + Task: func(_ context.Context) error { if err := c.SubmitLogsTasks(c.CiliumPods, c.Options.LogsSinceTime, c.Options.LogsLimitBytes); err != nil { return fmt.Errorf("failed to collect logs from Cilium pods") } @@ -1270,7 +1270,7 @@ func (c *Collector) Run() error { CreatesSubtasks: true, Description: "Collecting tracing data from Cilium pods", Quick: false, - Task: func(ctx context.Context) error { + Task: func(_ context.Context) error { if !c.Options.Tracing { return nil }