Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore unused parameters #1065

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cmd/subctl/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ var (
Short: "Prepare an OpenShift AWS cloud",
Long: "This command prepares an OpenShift installer-provisioned infrastructure (IPI) on AWS cloud for Submariner installation.",
PreRunE: checkAWSFlags,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(cloudRestConfigProducer.RunOnSelectedContext(
func(clusterInfo *cluster.Info, namespace string, status reporter.Interface) error {
func(clusterInfo *cluster.Info, _ string, status reporter.Interface) error {
return prepare.AWS( //nolint:wrapcheck // Not needed.
clusterInfo, &cloudOptions.ports, &awsConfig, cloudOptions.useLoadBalancer, status)
}, cli.NewReporter()))
Expand All @@ -56,9 +56,9 @@ var (
Long: "This command cleans up an OpenShift installer-provisioned infrastructure (IPI) on " +
"AWS-based cloud after Submariner uninstallation.",
PreRunE: checkAWSFlags,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(cloudRestConfigProducer.RunOnSelectedContext(
func(clusterInfo *cluster.Info, namespace string, status reporter.Interface) error {
func(clusterInfo *cluster.Info, _ string, status reporter.Interface) error {
return cleanup.AWS(clusterInfo, &awsConfig, status) //nolint:wrapcheck // No need to wrap errors here.
}, cli.NewReporter()))
},
Expand Down
8 changes: 4 additions & 4 deletions cmd/subctl/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ var (
Short: "Prepare an OpenShift Azure cloud",
Long: "This command prepares an OpenShift installer-provisioned infrastructure (IPI) on Azure cloud for Submariner installation.",
PreRunE: checkAzureFlags,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(cloudRestConfigProducer.RunOnSelectedContext(
func(clusterInfo *cluster.Info, namespace string, status reporter.Interface) error {
func(clusterInfo *cluster.Info, _ string, status reporter.Interface) error {
return prepare.Azure( //nolint:wrapcheck // Not needed.
clusterInfo, &cloudOptions.ports, &azureConfig, cloudOptions.useLoadBalancer, status)
}, cli.NewReporter()))
Expand All @@ -55,9 +55,9 @@ var (
Long: "This command cleans up an OpenShift installer-provisioned infrastructure (IPI) on " +
"Azure-based cloud after Submariner uninstallation.",
PreRunE: checkAzureFlags,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(cloudRestConfigProducer.RunOnSelectedContext(
func(clusterInfo *cluster.Info, namespace string, status reporter.Interface) error {
func(clusterInfo *cluster.Info, _ string, status reporter.Interface) error {
return cleanup.Azure(clusterInfo, &azureConfig, status) //nolint:wrapcheck // No need to wrap errors here.
}, cli.NewReporter()))
},
Expand Down
4 changes: 2 additions & 2 deletions cmd/subctl/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ func addBenchmarkFlags(cmd *cobra.Command) {
}

func buildBenchmarkRunner(run func(intraCluster, verbose bool) error) func(command *cobra.Command, args []string) {
return func(command *cobra.Command, args []string) {
return func(_ *cobra.Command, _ []string) {
exit.OnError(benchmarkRestConfigProducer.RunOnSelectedContext(
func(fromClusterInfo *cluster.Info, _ string, status reporter.Interface) error {
// Try to run using the "to" context
toContextPresent, err := benchmarkRestConfigProducer.RunOnSelectedPrefixedContext(
"to",
func(toClusterInfo *cluster.Info, _ string, status reporter.Interface) error {
func(toClusterInfo *cluster.Info, _ string, _ reporter.Interface) error {
return runBenchmark(run, fromClusterInfo, toClusterInfo, verbose)
}, status)

Expand Down
2 changes: 1 addition & 1 deletion cmd/subctl/deploybroker.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var deployRestConfigProducer = restconfig.NewProducer().
var deployBroker = &cobra.Command{
Use: "deploy-broker",
Short: "Deploys the broker",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(deployRestConfigProducer.RunOnSelectedContext(deployBrokerInContext, cli.NewReporter()))
},
}
Expand Down
22 changes: 11 additions & 11 deletions cmd/subctl/diagnose.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var (
Use: "cni",
Short: "Check the CNI network plugin",
Long: "This command checks if the detected CNI network plugin is supported by Submariner.",
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(
diagnoseRestConfigProducer.RunOnAllContexts(restconfig.IfConnectivityInstalled(diagnose.CNIConfig), cli.NewReporter()))
},
Expand All @@ -66,7 +66,7 @@ var (
Use: "connections",
Short: "Check the Gateway connections",
Long: "This command checks that the Gateway connections to other clusters are all established",
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(
diagnoseRestConfigProducer.RunOnAllContexts(restconfig.IfConnectivityInstalled(diagnose.Connections), cli.NewReporter()))
},
Expand All @@ -76,7 +76,7 @@ var (
Use: "deployment",
Short: "Check the Submariner deployment",
Long: "This command checks that the Submariner components are properly deployed and running with no overlapping CIDRs.",
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(
diagnoseRestConfigProducer.RunOnAllContexts(func(clusterInfo *cluster.Info, ns string, status reporter.Interface) error {
if clusterInfo.Submariner == nil && clusterInfo.ServiceDiscovery == nil {
Expand All @@ -94,7 +94,7 @@ var (
Use: "k8s-version",
Short: "Check the Kubernetes version",
Long: "This command checks if Submariner can be deployed on the Kubernetes version.",
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(diagnoseRestConfigProducer.RunOnAllContexts(diagnose.K8sVersion, cli.NewReporter()))
},
}
Expand All @@ -103,7 +103,7 @@ var (
Use: "kube-proxy-mode",
Short: "Check the kube-proxy mode",
Long: "This command checks if the kube-proxy mode is supported by Submariner.",
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(
diagnoseRestConfigProducer.RunOnAllContexts(restconfig.IfConnectivityInstalled(diagnose.KubeProxyMode), cli.NewReporter()))
},
Expand All @@ -120,7 +120,7 @@ var (
Short: "Check firewall access for intra-cluster Submariner VxLAN traffic",
Long: "This command checks if the firewall configuration allows traffic over vx-submariner interface.",
Args: checkNoArguments,
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(
diagnoseRestConfigProducer.RunOnAllContexts(restconfig.IfConnectivityInstalled(firewallIntraVxLANConfig), cli.NewReporter()))
},
Expand All @@ -131,7 +131,7 @@ var (
Short: "Check firewall access to setup tunnels between the Gateway node",
Long: "This command checks if the firewall configuration allows tunnels to be configured on the Gateway nodes.",
Args: checkNoArguments,
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
runLocalRemoteCommand(diagnoseFirewallTunnelRestConfigProducer, diagnose.TunnelConfigAcrossClusters)
},
}
Expand All @@ -141,7 +141,7 @@ var (
Short: "Check firewall access for nat-discovery to function properly",
Long: "This command checks if the firewall configuration allows nat-discovery between the configured Gateway nodes.",
Args: checkNoArguments,
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
runLocalRemoteCommand(diagnoseFirewallNatDiscoveryRestConfigProducer, diagnose.NatDiscoveryConfigAcrossClusters)
},
}
Expand All @@ -150,7 +150,7 @@ var (
Use: "all",
Short: "Run all diagnostic checks (except those requiring two kubecontexts)",
Long: "This command runs all diagnostic checks (except those requiring two kubecontexts) and reports any issues",
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(diagnoseAll(cli.NewReporter()))
},
}
Expand All @@ -159,7 +159,7 @@ var (
Use: "service-discovery",
Short: "Check service discovery functionality",
Long: "This command checks if service discovery is functioning properly.",
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(
diagnoseRestConfigProducer.RunOnAllContexts(
restconfig.IfServiceDiscoveryInstalled(diagnose.ServiceDiscovery), cli.NewReporter()))
Expand Down Expand Up @@ -272,7 +272,7 @@ func runLocalRemoteCommand(localRemoteRestConfigProducer *restconfig.Producer,
func(localClusterInfo *cluster.Info, localNamespace string, status reporter.Interface) error {
found, err := localRemoteRestConfigProducer.RunOnSelectedPrefixedContext(
"remote",
func(remoteClusterInfo *cluster.Info, remoteNamespace string, status reporter.Interface) error {
func(remoteClusterInfo *cluster.Info, _ string, status reporter.Interface) error {
return function(localClusterInfo, remoteClusterInfo, localNamespace, diagnoseFirewallOptions, status)
}, status)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/subctl/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var (
Short: "Exports a Service to other clusters",
Long: "This command creates a ServiceExport resource with the given name which causes the Service of the same name to be accessible" +
" to other clusters",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
err := validateArguments(args)
exit.OnErrorWithMessage(err, "Insufficient arguments")

Expand Down
2 changes: 1 addition & 1 deletion cmd/subctl/gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var gatherCmd = &cobra.Command{
Long: fmt.Sprintf("This command gathers information from a submariner cluster for troubleshooting. The information gathered "+
"can be selected by component (%v) and type (%v). Default is to capture all data.",
strings.Join(gather.AllModules.UnsortedList(), ","), strings.Join(gather.AllTypes.UnsortedList(), ",")),
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
if options.Directory == "" {
options.Directory = "submariner-" + time.Now().UTC().Format("20060102150405") // submariner-YYYYMMDDHHMMSS
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/subctl/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ var (
Short: "Prepare an OpenShift GCP cloud",
Long: "This command prepares an OpenShift installer-provisioned infrastructure (IPI) on GCP cloud for Submariner installation.",
PreRunE: checkGCPFlags,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(cloudRestConfigProducer.RunOnSelectedContext(
func(clusterInfo *cluster.Info, namespace string, status reporter.Interface) error {
func(clusterInfo *cluster.Info, _ string, status reporter.Interface) error {
return prepare.GCP( //nolint:wrapcheck // Not needed.
clusterInfo, &cloudOptions.ports, &gcpConfig, cloudOptions.useLoadBalancer, status)
}, cli.NewReporter()))
Expand All @@ -57,9 +57,9 @@ var (
Short: "Clean up a GCP cloud",
Long: "This command cleans up an installer-provisioned infrastructure (IPI) on GCP-based cloud after Submariner uninstallation.",
PreRunE: checkGCPFlags,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(cloudRestConfigProducer.RunOnSelectedContext(
func(clusterInfo *cluster.Info, namespace string, status reporter.Interface) error {
func(clusterInfo *cluster.Info, _ string, status reporter.Interface) error {
return cleanup.GCP(clusterInfo, &gcpConfig, status) //nolint:wrapcheck // No need to wrap errors here.
}, cli.NewReporter()))
},
Expand Down
4 changes: 2 additions & 2 deletions cmd/subctl/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var joinCmd = &cobra.Command{
Use: "join",
Short: "Connect a cluster to an existing broker",
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
status := cli.NewReporter()
checkArgumentPassed(args)

Expand All @@ -66,7 +66,7 @@ var joinCmd = &cobra.Command{
}

exit.OnError(joinRestConfigProducer.RunOnSelectedContext(
func(clusterInfo *cluster.Info, namespace string, status reporter.Interface) error {
func(clusterInfo *cluster.Info, _ string, status reporter.Interface) error {
return joinInContext(brokerInfo, clusterInfo, status)
}, status))
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/subctl/recover_broker_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var (
var recoverBrokerInfo = &cobra.Command{
Use: "recover-broker-info",
Short: "Recovers the broker-info.subm file from the installed Broker",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
status := cli.NewReporter()

exit.OnError(recoverRestConfigProducer.RunOnSelectedContext(restconfig.IfConnectivityInstalled(recoverBrokerInfoFromSubm), status))
Expand Down
8 changes: 4 additions & 4 deletions cmd/subctl/rhos.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ var (
Short: "Prepare an OpenShift RHOS cloud",
Long: "This command prepares an OpenShift installer-provisioned infrastructure (IPI) on RHOS cloud for Submariner installation.",
PreRunE: checkRHOSFlags,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(cloudRestConfigProducer.RunOnSelectedContext(
func(clusterInfo *cluster.Info, namespace string, status reporter.Interface) error {
func(clusterInfo *cluster.Info, _ string, status reporter.Interface) error {
return prepare.RHOS( //nolint:wrapcheck // Not needed.
clusterInfo, &cloudOptions.ports, &rhosConfig, cloudOptions.useLoadBalancer, status)
}, cli.NewReporter()))
Expand All @@ -55,9 +55,9 @@ var (
Long: "This command cleans up an OpenShift installer-provisioned infrastructure (IPI) on RHOS-based" +
" cloud after Submariner uninstallation.",
PreRunE: checkRHOSFlags,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(cloudRestConfigProducer.RunOnSelectedContext(
func(clusterInfo *cluster.Info, namespace string, status reporter.Interface) error {
func(clusterInfo *cluster.Info, _ string, status reporter.Interface) error {
return cleanup.RHOS(clusterInfo, &rhosConfig, status) //nolint:wrapcheck // No need to wrap errors here.
}, cli.NewReporter()))
},
Expand Down
14 changes: 7 additions & 7 deletions cmd/subctl/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var (
Use: "connections",
Short: "Show cluster connectivity information",
Long: `This command shows information about Submariner endpoint connections with other clusters.`,
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(
showRestConfigProducer.RunOnAllContexts(restconfig.IfConnectivityInstalled(show.Connections), cli.NewReporter()))
},
Expand All @@ -48,7 +48,7 @@ var (
Use: "endpoints",
Short: "Show Submariner endpoint information",
Long: `This command shows information about Submariner endpoints in a cluster.`,
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(
showRestConfigProducer.RunOnAllContexts(restconfig.IfConnectivityInstalled(show.Endpoints), cli.NewReporter()))
},
Expand All @@ -57,7 +57,7 @@ var (
Use: "gateways",
Short: "Show Submariner gateway summary information",
Long: `This command shows summary information about the Submariner gateways in a cluster.`,
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(
showRestConfigProducer.RunOnAllContexts(restconfig.IfConnectivityInstalled(show.Gateways), cli.NewReporter()))
},
Expand All @@ -66,7 +66,7 @@ var (
Use: "networks",
Short: "Get information on your cluster related to Submariner",
Long: `This command shows the status of Submariner in your cluster, and the relevant network details from your cluster.`,
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(
showRestConfigProducer.RunOnAllContexts(show.Network, cli.NewReporter()))
},
Expand All @@ -75,7 +75,7 @@ var (
Use: "versions",
Short: "Shows Submariner component versions",
Long: `This command shows the versions of the Submariner components in the cluster.`,
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(
showRestConfigProducer.RunOnAllContexts(show.Versions, cli.NewReporter()))
},
Expand All @@ -84,7 +84,7 @@ var (
Use: "brokers",
Short: "Shows Broker information",
Long: "This command shows information about the Broker in the cluster",
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(
showRestConfigProducer.RunOnAllContexts(show.Brokers, cli.NewReporter()))
},
Expand All @@ -94,7 +94,7 @@ var (
Short: "Show information related to a Submariner cluster",
Long: `This command shows information related to a Submariner cluster:
networks, endpoints, gateways, connections, broker and component versions.`,
Run: func(command *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(
showRestConfigProducer.RunOnAllContexts(show.All, cli.NewReporter()))
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/subctl/unexport.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var (
Short: "Stop a Service from being exported to other clusters",
Long: "This command removes the ServiceExport resource with the given name which in turn stops the Service " +
"of the same name from being exported to other clusters",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
err := validateUnexportArguments(args)
exit.OnErrorWithMessage(err, "Insufficient arguments")

Expand Down
2 changes: 1 addition & 1 deletion cmd/subctl/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var uninstallCmd = &cobra.Command{
Use: "uninstall",
Short: "Uninstall Submariner and its components",
Long: "This command uninstalls Submariner and its components",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
exit.OnError(uninstallRestConfigProducer.RunOnSelectedContext(uninstallInContext, cli.NewReporter()))
},
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/subctl/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ The following verifications are deemed disruptive:

` + strings.Join(disruptiveVerificationNames(), "\n "),
Args: checkVerifyArguments,
Run: func(cmd *cobra.Command, args []string) {
Run: func(cmd *cobra.Command, _ []string) {
exit.OnError(verifyRestConfigProducer.RunOnSelectedContext(
func(fromClusterInfo *cluster.Info, namespace string, status reporter.Interface) error {
// Try to run using the "to" context
Expand All @@ -91,7 +91,7 @@ The following verifications are deemed disruptive:
func(toClusterInfo *cluster.Info, _ string, status reporter.Interface) error {
extraContextPresent, err := verifyRestConfigProducer.RunOnSelectedPrefixedContext(
"extra",
func(extraClusterInfo *cluster.Info, _ string, status reporter.Interface) error {
func(extraClusterInfo *cluster.Info, _ string, _ reporter.Interface) error {
return runVerify(fromClusterInfo, toClusterInfo, extraClusterInfo, namespace, determineSpecLabelsToVerify())
}, status)
if extraContextPresent {
Expand Down
2 changes: 1 addition & 1 deletion internal/benchmark/latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func StartLatencyTests(intraCluster, verbose bool) error {
fmt.Printf("Performing latency tests\n")
}

gomega.RegisterFailHandler(func(message string, callerSkip ...int) {
gomega.RegisterFailHandler(func(message string, _ ...int) {
if f != nil {
cleanupFramework(f)
} else {
Expand Down
2 changes: 1 addition & 1 deletion internal/benchmark/throughput.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func StartThroughputTests(intraCluster, verbose bool) error {
fmt.Printf("Performing throughput tests\n")
}

gomega.RegisterFailHandler(func(message string, callerSkip ...int) {
gomega.RegisterFailHandler(func(message string, _ ...int) {
if f != nil {
cleanupFramework(f)
} else {
Expand Down
Loading