go: remove unused parameters

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
Paul Meyer 2023-03-20 11:03:36 +01:00
parent 822d7823f8
commit 0036b24266
106 changed files with 320 additions and 323 deletions

View File

@ -21,14 +21,14 @@ type clusterFake struct{}
// InitCluster fakes bootstrapping a new cluster with the current node being the master, returning the arguments required to join the cluster.
func (c *clusterFake) InitCluster(
context.Context, string, string, string, []byte, []uint32, bool,
context.Context, string, string, string, []byte, []uint32,
[]byte, bool, components.Components, *logger.Logger,
) ([]byte, error) {
return []byte{}, nil
}
// JoinCluster will fake joining the current node to an existing cluster.
func (c *clusterFake) JoinCluster(context.Context, *kubeadm.BootstrapTokenDiscovery, role.Role, string, components.Components, *logger.Logger) error {
func (c *clusterFake) JoinCluster(context.Context, *kubeadm.BootstrapTokenDiscovery, role.Role, components.Components, *logger.Logger) error {
return nil
}
@ -44,7 +44,7 @@ func (f *providerMetadataFake) List(ctx context.Context) ([]metadata.InstanceMet
return []metadata.InstanceMetadata{self}, err
}
func (f *providerMetadataFake) Self(ctx context.Context) (metadata.InstanceMetadata, error) {
func (f *providerMetadataFake) Self(_ context.Context) (metadata.InstanceMetadata, error) {
return metadata.InstanceMetadata{
Name: "instanceName",
ProviderID: "fake://instance-id",
@ -53,10 +53,10 @@ func (f *providerMetadataFake) Self(ctx context.Context) (metadata.InstanceMetad
}, nil
}
func (f *providerMetadataFake) GetLoadBalancerEndpoint(ctx context.Context) (string, error) {
func (f *providerMetadataFake) GetLoadBalancerEndpoint(_ context.Context) (string, error) {
return "", nil
}
func (f *providerMetadataFake) InitSecretHash(ctx context.Context) ([]byte, error) {
func (f *providerMetadataFake) InitSecretHash(_ context.Context) ([]byte, error) {
return nil, nil
}

View File

@ -198,7 +198,7 @@ func (s *stubCryptdevice) GetUUID() string {
return s.uuid
}
func (s *stubCryptdevice) KeyslotChangeByPassphrase(currentKeyslot int, newKeyslot int, currentPassphrase string, newPassphrase string) error {
func (s *stubCryptdevice) KeyslotChangeByPassphrase(_, _ int, _, _ string) error {
return s.keyslotChangeErr
}

View File

@ -178,7 +178,6 @@ func (s *Server) Init(ctx context.Context, req *initproto.InitRequest) (*initpro
clusterName,
measurementSalt,
req.EnforcedPcrs,
req.EnforceIdkeydigest,
req.HelmDeployments,
req.ConformanceMode,
components.NewComponentsFromInitProto(req.KubernetesComponents),
@ -254,7 +253,6 @@ type ClusterInitializer interface {
clusterName string,
measurementSalt []byte,
enforcedPcrs []uint32,
enforceIDKeyDigest bool,
helmDeployments []byte,
conformanceMode bool,
kubernetesComponents components.Components,

View File

@ -320,7 +320,7 @@ type stubClusterInitializer struct {
}
func (i *stubClusterInitializer) InitCluster(
context.Context, string, string, string, []byte, []uint32, bool,
context.Context, string, string, string, []byte, []uint32,
[]byte, bool, components.Components, *logger.Logger,
) ([]byte, error) {
return i.initClusterKubeconfig, i.initClusterErr

View File

@ -300,7 +300,7 @@ func (c *JoinClient) startNodeAndJoin(ticket *joinproto.IssueJoinTicketResponse,
}
k8sComponents := components.NewComponentsFromJoinProto(ticket.KubernetesComponents)
if err := c.joiner.JoinCluster(ctx, btd, c.role, ticket.KubernetesVersion, k8sComponents, c.log); err != nil {
if err := c.joiner.JoinCluster(ctx, btd, c.role, k8sComponents, c.log); err != nil {
return fmt.Errorf("joining Kubernetes cluster: %w", err)
}
@ -412,7 +412,6 @@ type ClusterJoiner interface {
ctx context.Context,
args *kubeadm.BootstrapTokenDiscovery,
peerRole role.Role,
k8sVersion string,
k8sComponents components.Components,
log *logger.Logger,
) error

View File

@ -393,7 +393,7 @@ type stubClusterJoiner struct {
joinClusterErr error
}
func (j *stubClusterJoiner) JoinCluster(context.Context, *kubeadm.BootstrapTokenDiscovery, role.Role, string, components.Components, *logger.Logger) error {
func (j *stubClusterJoiner) JoinCluster(context.Context, *kubeadm.BootstrapTokenDiscovery, role.Role, components.Components, *logger.Logger) error {
j.joinClusterCalled = true
return j.joinClusterErr
}

View File

@ -33,14 +33,14 @@ type stubProviderMetadata struct {
uidResp string
}
func (m *stubProviderMetadata) GetLoadBalancerEndpoint(ctx context.Context) (string, error) {
func (m *stubProviderMetadata) GetLoadBalancerEndpoint(_ context.Context) (string, error) {
return m.getLoadBalancerEndpointResp, m.getLoadBalancerEndpointErr
}
func (m *stubProviderMetadata) Self(ctx context.Context) (metadata.InstanceMetadata, error) {
func (m *stubProviderMetadata) Self(_ context.Context) (metadata.InstanceMetadata, error) {
return m.selfResp, m.selfErr
}
func (m *stubProviderMetadata) UID(ctx context.Context) (string, error) {
func (m *stubProviderMetadata) UID(_ context.Context) (string, error) {
return m.uidResp, m.uidErr
}

View File

@ -81,8 +81,8 @@ func New(cloudProvider string, clusterUtil clusterUtil, configProvider configura
// InitCluster initializes a new Kubernetes cluster and applies pod network provider.
func (k *KubeWrapper) InitCluster(
ctx context.Context, cloudServiceAccountURI, versionString, clusterName string,
measurementSalt []byte, enforcedPCRs []uint32, enforceIDKeyDigest bool,
helmReleasesRaw []byte, conformanceMode bool, kubernetesComponents components.Components, log *logger.Logger,
measurementSalt []byte, enforcedPCRs []uint32, helmReleasesRaw []byte, conformanceMode bool,
kubernetesComponents components.Components, log *logger.Logger,
) ([]byte, error) {
log.With(zap.String("version", versionString)).Infof("Installing Kubernetes components")
if err := k.clusterUtil.InstallComponents(ctx, kubernetesComponents); err != nil {
@ -266,7 +266,7 @@ func (k *KubeWrapper) InitCluster(
}
// JoinCluster joins existing Kubernetes cluster.
func (k *KubeWrapper) JoinCluster(ctx context.Context, args *kubeadm.BootstrapTokenDiscovery, peerRole role.Role, versionString string, k8sComponents components.Components, log *logger.Logger) error {
func (k *KubeWrapper) JoinCluster(ctx context.Context, args *kubeadm.BootstrapTokenDiscovery, peerRole role.Role, k8sComponents components.Components, log *logger.Logger) error {
log.With("k8sComponents", k8sComponents).Infof("Installing provided kubernetes components")
if err := k.clusterUtil.InstallComponents(ctx, k8sComponents); err != nil {
return fmt.Errorf("installing kubernetes components: %w", err)

View File

@ -216,7 +216,7 @@ func TestInitCluster(t *testing.T) {
_, err := kube.InitCluster(
context.Background(), serviceAccountURI, string(tc.k8sVersion), "kubernetes",
nil, nil, false, []byte("{}"), false, nil, logger.NewTest(t),
nil, nil, []byte("{}"), false, nil, logger.NewTest(t),
)
if tc.wantErr {
@ -242,7 +242,6 @@ func TestJoinCluster(t *testing.T) {
}
privateIP := "192.0.2.1"
k8sVersion := versions.Default
k8sComponents := components.Components{
{
@ -390,7 +389,7 @@ func TestJoinCluster(t *testing.T) {
getIPAddr: func() (string, error) { return privateIP, nil },
}
err := kube.JoinCluster(context.Background(), joinCommand, tc.role, string(k8sVersion), tc.k8sComponents, logger.NewTest(t))
err := kube.JoinCluster(context.Background(), joinCommand, tc.role, tc.k8sComponents, logger.NewTest(t))
if tc.wantErr {
assert.Error(err)
return
@ -468,40 +467,40 @@ type stubClusterUtil struct {
joinConfigs [][]byte
}
func (s *stubClusterUtil) SetupKonnectivity(kubectl k8sapi.Client, konnectivityAgentsDaemonSet kubernetes.Marshaler) error {
func (s *stubClusterUtil) SetupKonnectivity(_ k8sapi.Client, _ kubernetes.Marshaler) error {
return s.setupKonnectivityError
}
func (s *stubClusterUtil) InstallComponents(ctx context.Context, kubernetesComponents components.Components) error {
func (s *stubClusterUtil) InstallComponents(_ context.Context, _ components.Components) error {
return s.installComponentsErr
}
func (s *stubClusterUtil) InitCluster(ctx context.Context, initConfig []byte, nodeName, clusterName string, ips []net.IP, controlPlaneEndpoint string, conformanceMode bool, log *logger.Logger) ([]byte, error) {
func (s *stubClusterUtil) InitCluster(_ context.Context, initConfig []byte, _, _ string, _ []net.IP, _ string, _ bool, _ *logger.Logger) ([]byte, error) {
s.initConfigs = append(s.initConfigs, initConfig)
return s.kubeconfig, s.initClusterErr
}
func (s *stubClusterUtil) SetupAutoscaling(kubectl k8sapi.Client, clusterAutoscalerConfiguration kubernetes.Marshaler, secrets kubernetes.Marshaler) error {
func (s *stubClusterUtil) SetupAutoscaling(_ k8sapi.Client, _ kubernetes.Marshaler, _ kubernetes.Marshaler) error {
return s.setupAutoscalingError
}
func (s *stubClusterUtil) SetupGCPGuestAgent(kubectl k8sapi.Client, gcpGuestAgentConfiguration kubernetes.Marshaler) error {
func (s *stubClusterUtil) SetupGCPGuestAgent(_ k8sapi.Client, _ kubernetes.Marshaler) error {
return s.setupGCPGuestAgentErr
}
func (s *stubClusterUtil) SetupOperatorLifecycleManager(ctx context.Context, kubectl k8sapi.Client, olmCRDs, olmConfiguration kubernetes.Marshaler, crdNames []string) error {
func (s *stubClusterUtil) SetupOperatorLifecycleManager(_ context.Context, _ k8sapi.Client, _, _ kubernetes.Marshaler, _ []string) error {
return s.setupOLMErr
}
func (s *stubClusterUtil) SetupNodeMaintenanceOperator(kubectl k8sapi.Client, nodeMaintenanceOperatorConfiguration kubernetes.Marshaler) error {
func (s *stubClusterUtil) SetupNodeMaintenanceOperator(_ k8sapi.Client, _ kubernetes.Marshaler) error {
return s.setupNMOErr
}
func (s *stubClusterUtil) SetupNodeOperator(ctx context.Context, kubectl k8sapi.Client, nodeOperatorConfiguration kubernetes.Marshaler) error {
func (s *stubClusterUtil) SetupNodeOperator(_ context.Context, _ k8sapi.Client, _ kubernetes.Marshaler) error {
return s.setupNodeOperatorErr
}
func (s *stubClusterUtil) JoinCluster(ctx context.Context, joinConfig []byte, peerRole role.Role, controlPlaneEndpoint string, log *logger.Logger) error {
func (s *stubClusterUtil) JoinCluster(_ context.Context, joinConfig []byte, _ role.Role, _ string, _ *logger.Logger) error {
s.joinConfigs = append(s.joinConfigs, joinConfig)
return s.joinClusterErr
}
@ -510,11 +509,11 @@ func (s *stubClusterUtil) StartKubelet() error {
return s.startKubeletErr
}
func (s *stubClusterUtil) WaitForCilium(ctx context.Context, log *logger.Logger) error {
func (s *stubClusterUtil) WaitForCilium(_ context.Context, _ *logger.Logger) error {
return nil
}
func (s *stubClusterUtil) FixCilium(ctx context.Context) error {
func (s *stubClusterUtil) FixCilium(_ context.Context) error {
return nil
}
@ -549,31 +548,31 @@ type stubKubectl struct {
listAllNamespacesResp *corev1.NamespaceList
}
func (s *stubKubectl) Initialize(kubeconfig []byte) error {
func (s *stubKubectl) Initialize(_ []byte) error {
return nil
}
func (s *stubKubectl) CreateConfigMap(ctx context.Context, configMap corev1.ConfigMap) error {
func (s *stubKubectl) CreateConfigMap(_ context.Context, _ corev1.ConfigMap) error {
return s.createConfigMapErr
}
func (s *stubKubectl) AddTolerationsToDeployment(ctx context.Context, tolerations []corev1.Toleration, name string, namespace string) error {
func (s *stubKubectl) AddTolerationsToDeployment(_ context.Context, _ []corev1.Toleration, _, _ string) error {
return s.addTolerationsToDeploymentErr
}
func (s *stubKubectl) AddNodeSelectorsToDeployment(ctx context.Context, selectors map[string]string, name string, namespace string) error {
func (s *stubKubectl) AddNodeSelectorsToDeployment(_ context.Context, _ map[string]string, _, _ string) error {
return s.addTNodeSelectorsToDeploymentErr
}
func (s *stubKubectl) AnnotateNode(ctx context.Context, nodeName, annotationKey, annotationValue string) error {
func (s *stubKubectl) AnnotateNode(_ context.Context, _, _, _ string) error {
return s.annotateNodeErr
}
func (s *stubKubectl) WaitForCRDs(ctx context.Context, crds []string) error {
func (s *stubKubectl) WaitForCRDs(_ context.Context, _ []string) error {
return s.waitForCRDsErr
}
func (s *stubKubectl) ListAllNamespaces(ctx context.Context) (*corev1.NamespaceList, error) {
func (s *stubKubectl) ListAllNamespaces(_ context.Context) (*corev1.NamespaceList, error) {
return s.listAllNamespacesResp, s.listAllNamespacesErr
}
@ -584,19 +583,19 @@ type stubHelmClient struct {
servicesError error
}
func (s *stubHelmClient) InstallCilium(ctx context.Context, kubectl k8sapi.Client, release helm.Release, in k8sapi.SetupPodNetworkInput) error {
func (s *stubHelmClient) InstallCilium(_ context.Context, _ k8sapi.Client, _ helm.Release, _ k8sapi.SetupPodNetworkInput) error {
return s.ciliumError
}
func (s *stubHelmClient) InstallCertManager(ctx context.Context, release helm.Release) error {
func (s *stubHelmClient) InstallCertManager(_ context.Context, _ helm.Release) error {
return s.certManagerError
}
func (s *stubHelmClient) InstallOperators(ctx context.Context, release helm.Release, extraVals map[string]any) error {
func (s *stubHelmClient) InstallOperators(_ context.Context, _ helm.Release, _ map[string]any) error {
return s.operatorsError
}
func (s *stubHelmClient) InstallConstellationServices(ctx context.Context, release helm.Release, extraVals map[string]any) error {
func (s *stubHelmClient) InstallConstellationServices(_ context.Context, _ helm.Release, _ map[string]any) error {
return s.servicesError
}

View File

@ -55,6 +55,6 @@ type stubKubernetesClient struct {
listAllNamespacesErr error
}
func (c *stubKubernetesClient) ListAllNamespaces(ctx context.Context) (*corev1.NamespaceList, error) {
func (c *stubKubernetesClient) ListAllNamespaces(_ context.Context) (*corev1.NamespaceList, error) {
return nil, c.listAllNamespacesErr
}

View File

@ -24,7 +24,7 @@ type CloudLogger interface {
type NopLogger struct{}
// Disclose does nothing.
func (l *NopLogger) Disclose(msg string) {}
func (l *NopLogger) Disclose(_ string) {}
// Close does nothing.
func (l *NopLogger) Close() error {

View File

@ -90,7 +90,7 @@ func signalContext(ctx context.Context, sig os.Signal) (context.Context, context
return sigCtx, cancelFunc
}
func preRunRoot(cmd *cobra.Command, args []string) {
func preRunRoot(cmd *cobra.Command, _ []string) {
cmd.SilenceUsage = true
}

View File

@ -45,7 +45,7 @@ type stubTerraformClient struct {
showErr error
}
func (c *stubTerraformClient) CreateCluster(ctx context.Context) (terraform.CreateOutput, error) {
func (c *stubTerraformClient) CreateCluster(_ context.Context) (terraform.CreateOutput, error) {
return terraform.CreateOutput{
IP: c.ip,
Secret: c.initSecret,
@ -54,15 +54,15 @@ func (c *stubTerraformClient) CreateCluster(ctx context.Context) (terraform.Crea
}, c.createClusterErr
}
func (c *stubTerraformClient) CreateIAMConfig(ctx context.Context, provider cloudprovider.Provider) (terraform.IAMOutput, error) {
func (c *stubTerraformClient) CreateIAMConfig(_ context.Context, _ cloudprovider.Provider) (terraform.IAMOutput, error) {
return c.iamOutput, c.iamOutputErr
}
func (c *stubTerraformClient) PrepareWorkspace(path string, input terraform.Variables) error {
func (c *stubTerraformClient) PrepareWorkspace(_ string, _ terraform.Variables) error {
return c.prepareWorkspaceErr
}
func (c *stubTerraformClient) Destroy(ctx context.Context) error {
func (c *stubTerraformClient) Destroy(_ context.Context) error {
c.destroyCalled = true
return c.destroyErr
}
@ -76,7 +76,7 @@ func (c *stubTerraformClient) RemoveInstaller() {
c.removeInstallerCalled = true
}
func (c *stubTerraformClient) Show(ctx context.Context) (*tfjson.State, error) {
func (c *stubTerraformClient) Show(_ context.Context) (*tfjson.State, error) {
c.showCalled = true
return c.tfjsonState, c.showErr
}

View File

@ -431,7 +431,7 @@ type stubDynamicClient struct {
updateErr error
}
func (u *stubDynamicClient) getCurrent(ctx context.Context, name string) (*unstructured.Unstructured, error) {
func (u *stubDynamicClient) getCurrent(_ context.Context, _ string) (*unstructured.Unstructured, error) {
return u.object, u.getErr
}
@ -450,16 +450,16 @@ type stubStableClient struct {
k8sErr error
}
func (s *stubStableClient) getCurrentConfigMap(ctx context.Context, name string) (*corev1.ConfigMap, error) {
func (s *stubStableClient) getCurrentConfigMap(_ context.Context, _ string) (*corev1.ConfigMap, error) {
return s.configMap, s.getErr
}
func (s *stubStableClient) updateConfigMap(ctx context.Context, configMap *corev1.ConfigMap) (*corev1.ConfigMap, error) {
func (s *stubStableClient) updateConfigMap(_ context.Context, configMap *corev1.ConfigMap) (*corev1.ConfigMap, error) {
s.updatedConfigMap = configMap
return s.updatedConfigMap, s.updateErr
}
func (s *stubStableClient) createConfigMap(ctx context.Context, configMap *corev1.ConfigMap) (*corev1.ConfigMap, error) {
func (s *stubStableClient) createConfigMap(_ context.Context, configMap *corev1.ConfigMap) (*corev1.ConfigMap, error) {
s.configMap = configMap
return s.configMap, s.createErr
}

View File

@ -33,11 +33,11 @@ type stubCloudCreator struct {
}
func (c *stubCloudCreator) Create(
ctx context.Context,
_ context.Context,
provider cloudprovider.Provider,
config *config.Config,
insType string,
coordCount, nodeCount int,
_ *config.Config,
_ string,
_, _ int,
) (clusterid.File, error) {
c.createCalled = true
c.id.CloudProvider = provider
@ -65,9 +65,9 @@ type stubIAMCreator struct {
}
func (c *stubIAMCreator) Create(
ctx context.Context,
_ context.Context,
provider cloudprovider.Provider,
iamConfig *cloudcmd.IAMConfig,
_ *cloudcmd.IAMConfig,
) (iamid.File, error) {
c.createCalled = true
c.id.CloudProvider = provider
@ -82,12 +82,12 @@ type stubIAMDestroyer struct {
getTfstateKeyErr error
}
func (d *stubIAMDestroyer) DestroyIAMConfiguration(ctx context.Context) error {
func (d *stubIAMDestroyer) DestroyIAMConfiguration(_ context.Context) error {
d.destroyCalled = true
return d.destroyErr
}
func (d *stubIAMDestroyer) GetTfstateServiceAccountKey(ctx context.Context) (gcpshared.ServiceAccountKey, error) {
func (d *stubIAMDestroyer) GetTfstateServiceAccountKey(_ context.Context) (gcpshared.ServiceAccountKey, error) {
d.getTfstateKeyCalled = true
return d.gcpSaKey, d.getTfstateKeyErr
}

View File

@ -53,7 +53,7 @@ type configFetchMeasurementsCmd struct {
log debugLog
}
func runConfigFetchMeasurements(cmd *cobra.Command, args []string) error {
func runConfigFetchMeasurements(cmd *cobra.Command, _ []string) error {
log, err := newCLILogger(cmd)
if err != nil {
return fmt.Errorf("creating logger: %w", err)

View File

@ -156,7 +156,7 @@ func parseGenerateFlags(cmd *cobra.Command) (generateFlags, error) {
// createCompletion handles the completion of the create command. It is frequently called
// while the user types arguments of the command to suggest completion.
func generateCompletion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
func generateCompletion(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) {
switch len(args) {
case 0:
return []string{"aws", "gcp", "azure", "qemu"}, cobra.ShellCompDirectiveNoFileComp

View File

@ -25,7 +25,7 @@ func newConfigInstanceTypesCmd() *cobra.Command {
return cmd
}
func printSupportedInstanceTypes(cmd *cobra.Command, args []string) {
func printSupportedInstanceTypes(cmd *cobra.Command, _ []string) {
cmd.Printf(`AWS instance families:
%v
Azure Confidential VM instance types:

View File

@ -25,7 +25,7 @@ func newConfigKubernetesVersionsCmd() *cobra.Command {
return cmd
}
func printSupportedKubernetesVersions(cmd *cobra.Command, args []string) {
func printSupportedKubernetesVersions(cmd *cobra.Command, _ []string) {
cmd.Printf("Supported Kubernetes Versions:\n\t%s\n", formatKubernetesVersions())
}

View File

@ -42,7 +42,7 @@ type createCmd struct {
log debugLog
}
func runCreate(cmd *cobra.Command, args []string) error {
func runCreate(cmd *cobra.Command, _ []string) error {
log, err := newCLILogger(cmd)
if err != nil {
return fmt.Errorf("creating logger: %w", err)

View File

@ -423,7 +423,7 @@ func (c *awsIAMCreator) writeOutputValuesToConfig(conf *config.Config, flags iam
conf.Provider.AWS.IAMProfileWorkerNodes = iamFile.AWSOutput.WorkerNodeInstanceProfile
}
func (c *awsIAMCreator) parseAndWriteIDFile(iamFile iamid.File, fileHandler file.Handler) error {
func (c *awsIAMCreator) parseAndWriteIDFile(_ iamid.File, _ file.Handler) error {
return nil
}
@ -488,7 +488,7 @@ func (c *azureIAMCreator) writeOutputValuesToConfig(conf *config.Config, flags i
conf.Provider.Azure.ClientSecretValue = iamFile.AzureOutput.ApplicationClientSecretValue
}
func (c *azureIAMCreator) parseAndWriteIDFile(iamFile iamid.File, fileHandler file.Handler) error {
func (c *azureIAMCreator) parseAndWriteIDFile(_ iamid.File, _ file.Handler) error {
return nil
}
@ -552,14 +552,14 @@ func (c *gcpIAMCreator) printConfirmValues(cmd *cobra.Command, flags iamFlags) {
cmd.Printf("Zone:\t\t\t%s\n\n", flags.gcp.zone)
}
func (c *gcpIAMCreator) printOutputValues(cmd *cobra.Command, flags iamFlags, iamFile iamid.File) {
func (c *gcpIAMCreator) printOutputValues(cmd *cobra.Command, _ iamFlags, _ iamid.File) {
cmd.Printf("projectID:\t\t%s\n", constants.GCPServiceAccountKeyFile)
cmd.Printf("region:\t\t\t%s\n", constants.GCPServiceAccountKeyFile)
cmd.Printf("zone:\t\t\t%s\n", constants.GCPServiceAccountKeyFile)
cmd.Printf("serviceAccountKeyPath:\t%s\n\n", constants.GCPServiceAccountKeyFile)
}
func (c *gcpIAMCreator) writeOutputValuesToConfig(conf *config.Config, flags iamFlags, iamFile iamid.File) {
func (c *gcpIAMCreator) writeOutputValuesToConfig(conf *config.Config, flags iamFlags, _ iamid.File) {
conf.Provider.GCP.Project = flags.gcp.projectID
conf.Provider.GCP.ServiceAccountKeyPath = constants.GCPServiceAccountKeyFile
conf.Provider.GCP.Region = flags.gcp.region

View File

@ -33,7 +33,7 @@ func newIAMDestroyCmd() *cobra.Command {
return cmd
}
func runIAMDestroy(cmd *cobra.Command, _args []string) error {
func runIAMDestroy(cmd *cobra.Command, _ []string) error {
log, err := newCLILogger(cmd)
if err != nil {
return fmt.Errorf("creating logger: %w", err)

View File

@ -71,7 +71,7 @@ type initCmd struct {
}
// runInitialize runs the initialize command.
func runInitialize(cmd *cobra.Command, args []string) error {
func runInitialize(cmd *cobra.Command, _ []string) error {
log, err := newCLILogger(cmd)
if err != nil {
return fmt.Errorf("creating logger: %w", err)

View File

@ -464,7 +464,7 @@ type testValidator struct {
pcrs measurements.M
}
func (v *testValidator) Validate(attDoc []byte, nonce []byte) ([]byte, error) {
func (v *testValidator) Validate(attDoc []byte, _ []byte) ([]byte, error) {
var attestation struct {
UserData []byte
PCRs map[uint32][]byte
@ -486,7 +486,7 @@ type testIssuer struct {
pcrs map[uint32][]byte
}
func (i *testIssuer) Issue(userData []byte, nonce []byte) ([]byte, error) {
func (i *testIssuer) Issue(userData []byte, _ []byte) ([]byte, error) {
return json.Marshal(
struct {
UserData []byte
@ -505,7 +505,7 @@ type stubInitServer struct {
initproto.UnimplementedAPIServer
}
func (s *stubInitServer) Init(ctx context.Context, req *initproto.InitRequest) (*initproto.InitResponse, error) {
func (s *stubInitServer) Init(_ context.Context, _ *initproto.InitRequest) (*initproto.InitResponse, error) {
return s.initResp, s.initErr
}
@ -563,7 +563,7 @@ func defaultConfigWithExpectedMeasurements(t *testing.T, conf *config.Config, cs
type stubLicenseClient struct{}
func (c *stubLicenseClient) QuotaCheck(ctx context.Context, checkRequest license.QuotaCheckRequest) (license.QuotaCheckResponse, error) {
func (c *stubLicenseClient) QuotaCheck(_ context.Context, _ license.QuotaCheckRequest) (license.QuotaCheckResponse, error) {
return license.QuotaCheckResponse{
Quota: 25,
}, nil

View File

@ -51,7 +51,7 @@ type miniUpCmd struct {
log debugLog
}
func runUp(cmd *cobra.Command, args []string) error {
func runUp(cmd *cobra.Command, _ []string) error {
log, err := newCLILogger(cmd)
if err != nil {
return fmt.Errorf("creating logger: %w", err)

View File

@ -343,4 +343,4 @@ func (d *stubDoer) Do(context.Context) error {
func (d *stubDoer) setDialer(grpcDialer, string) {}
func (d *stubDoer) setURIs(kmsURI, storageURI string) {}
func (d *stubDoer) setURIs(_, _ string) {}

View File

@ -34,7 +34,7 @@ func NewTerminateCmd() *cobra.Command {
}
// runTerminate runs the terminate command.
func runTerminate(cmd *cobra.Command, args []string) error {
func runTerminate(cmd *cobra.Command, _ []string) error {
fileHandler := file.NewHandler(afero.NewOsFs())
spinner, err := newSpinnerOrStderr(cmd)
if err != nil {

View File

@ -41,7 +41,7 @@ func newUpgradeApplyCmd() *cobra.Command {
return cmd
}
func runUpgradeApply(cmd *cobra.Command, args []string) error {
func runUpgradeApply(cmd *cobra.Command, _ []string) error {
log, err := newCLILogger(cmd)
if err != nil {
return fmt.Errorf("creating logger: %w", err)

View File

@ -73,10 +73,10 @@ type stubUpgrader struct {
helmErr error
}
func (u stubUpgrader) UpgradeNodeVersion(ctx context.Context, conf *config.Config) error {
func (u stubUpgrader) UpgradeNodeVersion(_ context.Context, _ *config.Config) error {
return u.nodeVersionErr
}
func (u stubUpgrader) UpgradeHelmServices(ctx context.Context, config *config.Config, timeout time.Duration, allowDestructive bool) error {
func (u stubUpgrader) UpgradeHelmServices(_ context.Context, _ *config.Config, _ time.Duration, _ bool) error {
return u.helmErr
}

View File

@ -50,7 +50,7 @@ func newUpgradeCheckCmd() *cobra.Command {
return cmd
}
func runUpgradeCheck(cmd *cobra.Command, args []string) error {
func runUpgradeCheck(cmd *cobra.Command, _ []string) error {
log, err := newCLILogger(cmd)
if err != nil {
return fmt.Errorf("creating logger: %w", err)
@ -144,7 +144,7 @@ func (u *upgradeCheckCmd) upgradeCheck(cmd *cobra.Command, fileHandler file.Hand
return err
}
supportedServices, supportedImages, supportedK8s, err := u.collect.supportedVersions(cmd.Context(), currentImage, csp)
supportedServices, supportedImages, supportedK8s, err := u.collect.supportedVersions(cmd.Context(), currentImage)
if err != nil {
return err
}
@ -229,10 +229,10 @@ func filterK8sUpgrades(currentVersion string, newVersions []string) []string {
type collector interface {
currentVersions(ctx context.Context) (serviceVersions string, imageVersion string, k8sVersion string, err error)
supportedVersions(ctx context.Context, version string, csp cloudprovider.Provider) (serviceVersions string, imageVersions []versionsapi.Version, k8sVersions []string, err error)
newImages(ctx context.Context, version string, csp cloudprovider.Provider) ([]versionsapi.Version, error)
supportedVersions(ctx context.Context, version string) (serviceVersions string, imageVersions []versionsapi.Version, k8sVersions []string, err error)
newImages(ctx context.Context, version string) ([]versionsapi.Version, error)
newMeasurementes(ctx context.Context, csp cloudprovider.Provider, images []versionsapi.Version) (map[string]measurements.M, error)
newerVersions(ctx context.Context, currentVersion string, allowedVersions []string) ([]versionsapi.Version, error)
newerVersions(ctx context.Context, allowedVersions []string) ([]versionsapi.Version, error)
}
type versionCollector struct {
@ -283,13 +283,13 @@ func (v *versionCollector) currentVersions(ctx context.Context) (serviceVersion
}
// supportedVersions returns slices of supported versions.
func (v *versionCollector) supportedVersions(ctx context.Context, version string, csp cloudprovider.Provider) (serviceVersion string, imageVersions []versionsapi.Version, k8sVersions []string, err error) {
func (v *versionCollector) supportedVersions(ctx context.Context, version string) (serviceVersion string, imageVersions []versionsapi.Version, k8sVersions []string, err error) {
k8sVersions = versions.SupportedK8sVersions()
serviceVersion, err = helm.AvailableServiceVersions()
if err != nil {
return "", nil, nil, fmt.Errorf("loading service versions: %w", err)
}
imageVersions, err = v.newImages(ctx, version, csp)
imageVersions, err = v.newImages(ctx, version)
if err != nil {
return "", nil, nil, fmt.Errorf("loading image versions: %w", err)
}
@ -297,7 +297,7 @@ func (v *versionCollector) supportedVersions(ctx context.Context, version string
return serviceVersion, imageVersions, k8sVersions, nil
}
func (v *versionCollector) newImages(ctx context.Context, version string, csp cloudprovider.Provider) ([]versionsapi.Version, error) {
func (v *versionCollector) newImages(ctx context.Context, version string) ([]versionsapi.Version, error) {
// find compatible images
// image updates should always be possible for the current minor version of the cluster
// (e.g. 0.1.0 -> 0.1.1, 0.1.2, 0.1.3, etc.)
@ -329,7 +329,7 @@ func (v *versionCollector) newImages(ctx context.Context, version string, csp cl
}
v.log.Debugf("Allowed minor versions are %#v", allowedMinorVersions)
newerImages, err := v.newerVersions(ctx, currentImageMinorVer, allowedMinorVersions)
newerImages, err := v.newerVersions(ctx, allowedMinorVersions)
if err != nil {
return nil, fmt.Errorf("newer versions: %w", err)
}
@ -337,7 +337,7 @@ func (v *versionCollector) newImages(ctx context.Context, version string, csp cl
return newerImages, nil
}
func (v *versionCollector) newerVersions(ctx context.Context, currentVersion string, allowedVersions []string) ([]versionsapi.Version, error) {
func (v *versionCollector) newerVersions(ctx context.Context, allowedVersions []string) ([]versionsapi.Version, error) {
var updateCandidates []versionsapi.Version
for _, minorVer := range allowedVersions {
patchList := versionsapi.List{

View File

@ -267,23 +267,23 @@ type stubVersionCollector struct {
someErr error
}
func (s *stubVersionCollector) newMeasurementes(ctx context.Context, csp cloudprovider.Provider, images []versionsapi.Version) (map[string]measurements.M, error) {
func (s *stubVersionCollector) newMeasurementes(_ context.Context, _ cloudprovider.Provider, _ []versionsapi.Version) (map[string]measurements.M, error) {
return s.supportedImageVersions, nil
}
func (s *stubVersionCollector) currentVersions(ctx context.Context) (serviceVersions string, imageVersion string, k8sVersion string, err error) {
func (s *stubVersionCollector) currentVersions(_ context.Context) (serviceVersions string, imageVersion string, k8sVersion string, err error) {
return s.currentServicesVersions, s.currentImageVersion, s.currentK8sVersion, s.someErr
}
func (s *stubVersionCollector) supportedVersions(ctx context.Context, version string, csp cloudprovider.Provider) (serviceVersions string, imageVersions []versionsapi.Version, k8sVersions []string, err error) {
func (s *stubVersionCollector) supportedVersions(_ context.Context, _ string) (serviceVersions string, imageVersions []versionsapi.Version, k8sVersions []string, err error) {
return s.supportedServicesVersions, s.supportedImages, s.supportedK8sVersions, s.someErr
}
func (s *stubVersionCollector) newImages(ctx context.Context, version string, csp cloudprovider.Provider) ([]versionsapi.Version, error) {
func (s *stubVersionCollector) newImages(_ context.Context, _ string) ([]versionsapi.Version, error) {
return s.images, nil
}
func (s *stubVersionCollector) newerVersions(ctx context.Context, currentVersion string, allowedVersions []string) ([]versionsapi.Version, error) {
func (s *stubVersionCollector) newerVersions(_ context.Context, _ []string) ([]versionsapi.Version, error) {
return s.images, nil
}
@ -297,6 +297,6 @@ func (u stubUpgradeChecker) CurrentImage(context.Context) (string, error) {
return u.image, u.err
}
func (u stubUpgradeChecker) CurrentKubernetesVersion(ctx context.Context) (string, error) {
func (u stubUpgradeChecker) CurrentKubernetesVersion(_ context.Context) (string, error) {
return u.k8sVersion, u.err
}

View File

@ -50,7 +50,7 @@ type verifyCmd struct {
log debugLog
}
func runVerify(cmd *cobra.Command, args []string) error {
func runVerify(cmd *cobra.Command, _ []string) error {
log, err := newCLILogger(cmd)
if err != nil {
return fmt.Errorf("creating logger: %w", err)

View File

@ -263,7 +263,7 @@ type stubVerifyClient struct {
endpoint string
}
func (c *stubVerifyClient) Verify(ctx context.Context, endpoint string, req *verifyproto.GetAttestationRequest, validator atls.Validator) error {
func (c *stubVerifyClient) Verify(_ context.Context, endpoint string, _ *verifyproto.GetAttestationRequest, _ atls.Validator) error {
c.endpoint = endpoint
return c.verifyErr
}

View File

@ -26,7 +26,7 @@ func NewVersionCmd() *cobra.Command {
return cmd
}
func runVersion(cmd *cobra.Command, args []string) {
func runVersion(cmd *cobra.Command, _ []string) {
buildInfo, ok := debug.ReadBuildInfo()
var commit, state, date, goVersion, compiler, platform string
if ok {

View File

@ -142,8 +142,8 @@ func TestBackupCRs(t *testing.T) {
type stubLog struct{}
func (s stubLog) Debugf(format string, args ...any) {}
func (s stubLog) Sync() {}
func (s stubLog) Debugf(_ string, _ ...any) {}
func (s stubLog) Sync() {}
type stubCrdClient struct {
crds []apiextensionsv1.CustomResourceDefinition
@ -153,14 +153,14 @@ type stubCrdClient struct {
crdClient
}
func (c stubCrdClient) GetCRDs(ctx context.Context) ([]apiextensionsv1.CustomResourceDefinition, error) {
func (c stubCrdClient) GetCRDs(_ context.Context) ([]apiextensionsv1.CustomResourceDefinition, error) {
if c.getCRDsError != nil {
return nil, c.getCRDsError
}
return c.crds, nil
}
func (c stubCrdClient) GetCRs(ctx context.Context, gvr schema.GroupVersionResource) ([]unstructured.Unstructured, error) {
func (c stubCrdClient) GetCRs(_ context.Context, _ schema.GroupVersionResource) ([]unstructured.Unstructured, error) {
if c.getCRsError != nil {
return nil, c.getCRsError
}

View File

@ -73,10 +73,10 @@ func (a *stubActionWrapper) listAction(_ string) ([]*release.Release, error) {
return []*release.Release{{Chart: &chart.Chart{Metadata: &chart.Metadata{Version: a.version}}}}, nil
}
func (a *stubActionWrapper) getValues(release string) (map[string]any, error) {
func (a *stubActionWrapper) getValues(_ string) (map[string]any, error) {
return nil, nil
}
func (a *stubActionWrapper) upgradeAction(ctx context.Context, releaseName string, chart *chart.Chart, values map[string]any, timeout time.Duration) error {
func (a *stubActionWrapper) upgradeAction(_ context.Context, _ string, _ *chart.Chart, _ map[string]any, _ time.Duration) error {
return nil
}

View File

@ -321,7 +321,7 @@ type stubVersionsAPIImageFetcher struct {
fetchImageInfoErr error
}
func (f *stubVersionsAPIImageFetcher) FetchImageInfo(ctx context.Context, imageInfo versionsapi.ImageInfo) (
func (f *stubVersionsAPIImageFetcher) FetchImageInfo(_ context.Context, _ versionsapi.ImageInfo) (
versionsapi.ImageInfo, error,
) {
return f.fetchImageInfoInfo, f.fetchImageInfoErr

View File

@ -460,7 +460,7 @@ func TestIsIntegrityFS(t *testing.T) {
type fakeKMS struct{}
func (k *fakeKMS) GetDEK(ctx context.Context, dekID string, dekSize int) ([]byte, error) {
func (k *fakeKMS) GetDEK(_ context.Context, _ string, dekSize int) ([]byte, error) {
key := make([]byte, dekSize)
for i := range key {
key[i] = 0x41

View File

@ -154,7 +154,7 @@ func TestDeviceCloning(t *testing.T) {
type fakeKMS struct{}
func (k *fakeKMS) GetDEK(ctx context.Context, dekID string, dekSize int) ([]byte, error) {
func (k *fakeKMS) GetDEK(_ context.Context, _ string, dekSize int) ([]byte, error) {
key := make([]byte, dekSize)
for i := range key {
key[i] = 0x41
@ -164,7 +164,7 @@ func (k *fakeKMS) GetDEK(ctx context.Context, dekID string, dekSize int) ([]byte
type dynamicKMS struct{}
func (k *dynamicKMS) GetDEK(ctx context.Context, dekID string, dekSize int) ([]byte, error) {
func (k *dynamicKMS) GetDEK(_ context.Context, dekID string, dekSize int) ([]byte, error) {
key := make([]byte, dekSize)
for i := range key {
key[i] = 0x41 ^ dekID[i%len(dekID)]

View File

@ -49,7 +49,7 @@ func newDeployCmd() *cobra.Command {
return deployCmd
}
func runDeploy(cmd *cobra.Command, args []string) error {
func runDeploy(cmd *cobra.Command, _ []string) error {
verbosity, err := cmd.Flags().GetInt("verbosity")
if err != nil {
return err

View File

@ -213,12 +213,12 @@ type stubServiceManager struct {
overrideServiceUnitExecStartErr error
}
func (s *stubServiceManager) SystemdAction(ctx context.Context, request ServiceManagerRequest) error {
func (s *stubServiceManager) SystemdAction(_ context.Context, request ServiceManagerRequest) error {
s.requests = append(s.requests, request)
return s.systemdActionErr
}
func (s *stubServiceManager) OverrideServiceUnitExecStart(ctx context.Context, unitName string, execStart string) error {
func (s *stubServiceManager) OverrideServiceUnitExecStart(_ context.Context, unitName string, execStart string) error {
s.overrideCalls = append(s.overrideCalls, struct {
UnitName, ExecStart string
}{UnitName: unitName, ExecStart: execStart})
@ -245,7 +245,7 @@ type stubDownloadServer struct {
pb.UnimplementedDebugdServer
}
func (s *stubDownloadServer) DownloadFiles(request *pb.DownloadFilesRequest, stream pb.Debugd_DownloadFilesServer) error {
func (s *stubDownloadServer) DownloadFiles(_ *pb.DownloadFilesRequest, _ pb.Debugd_DownloadFilesServer) error {
return s.downladErr
}
@ -255,7 +255,7 @@ type stubDebugdServer struct {
pb.UnimplementedDebugdServer
}
func (s *stubDebugdServer) GetInfo(ctx context.Context, request *pb.GetInfoRequest) (*pb.GetInfoResponse, error) {
func (s *stubDebugdServer) GetInfo(_ context.Context, _ *pb.GetInfoRequest) (*pb.GetInfoResponse, error) {
return &pb.GetInfoResponse{Info: s.info}, s.getInfoErr
}

View File

@ -320,7 +320,7 @@ type stubDbus struct {
connErr error
}
func (s *stubDbus) NewSystemConnectionContext(ctx context.Context) (dbusConn, error) {
func (s *stubDbus) NewSystemConnectionContext(_ context.Context) (dbusConn, error) {
return s.conn, s.connErr
}
@ -339,28 +339,28 @@ type fakeDbusConn struct {
reloadErr error
}
func (c *fakeDbusConn) StartUnitContext(ctx context.Context, name string, mode string, ch chan<- string) (int, error) {
func (c *fakeDbusConn) StartUnitContext(_ context.Context, name string, mode string, ch chan<- string) (int, error) {
c.inputs = append(c.inputs, dbusConnActionInput{name: name, mode: mode})
ch <- c.result
return c.jobID, c.actionErr
}
func (c *fakeDbusConn) StopUnitContext(ctx context.Context, name string, mode string, ch chan<- string) (int, error) {
func (c *fakeDbusConn) StopUnitContext(_ context.Context, name string, mode string, ch chan<- string) (int, error) {
c.inputs = append(c.inputs, dbusConnActionInput{name: name, mode: mode})
ch <- c.result
return c.jobID, c.actionErr
}
func (c *fakeDbusConn) RestartUnitContext(ctx context.Context, name string, mode string, ch chan<- string) (int, error) {
func (c *fakeDbusConn) RestartUnitContext(_ context.Context, name string, mode string, ch chan<- string) (int, error) {
c.inputs = append(c.inputs, dbusConnActionInput{name: name, mode: mode})
ch <- c.result
return c.jobID, c.actionErr
}
func (c *fakeDbusConn) ReloadContext(ctx context.Context) error {
func (c *fakeDbusConn) ReloadContext(_ context.Context) error {
c.reloadCalls++
return c.reloadErr

View File

@ -265,7 +265,7 @@ func TestGetProto(t *testing.T) {
}
}
func TestConcurrency(t *testing.T) {
func TestConcurrency(_ *testing.T) {
i := NewMap()
get := func() {
@ -308,4 +308,5 @@ func TestConcurrency(t *testing.T) {
go received()
go received()
go received()
// TODO(katexochen): fix this test, wait for routines to finish
}

View File

@ -244,7 +244,7 @@ func newQemuCloudCredentialGetter(infoMap *info.Map) (*qemuCloudCredentialGetter
}, nil
}
func (q *qemuCloudCredentialGetter) GetOpensearchCredentials(ctx context.Context) (credentials, error) {
func (q *qemuCloudCredentialGetter) GetOpensearchCredentials(_ context.Context) (credentials, error) {
return q.creds, nil
}

View File

@ -84,8 +84,8 @@ type stubGCPSecretManagerAPI struct {
accessSecretVersionErr error
}
func (s stubGCPSecretManagerAPI) AccessSecretVersion(ctx context.Context, req *secretmanagerpb.AccessSecretVersionRequest,
opts ...gax.CallOption,
func (s stubGCPSecretManagerAPI) AccessSecretVersion(_ context.Context, _ *secretmanagerpb.AccessSecretVersionRequest,
_ ...gax.CallOption,
) (*secretmanagerpb.AccessSecretVersionResponse, error) {
return s.assessSecretVersionResp, s.accessSecretVersionErr
}
@ -144,7 +144,7 @@ type stubAzureSecretsAPI struct {
getSecretErr error
}
func (s stubAzureSecretsAPI) GetSecret(ctx context.Context, name string, version string, options *azsecrets.GetSecretOptions,
func (s stubAzureSecretsAPI) GetSecret(_ context.Context, _, _ string, _ *azsecrets.GetSecretOptions,
) (azsecrets.GetSecretResponse, error) {
return s.getSecretResp, s.getSecretErr
}
@ -201,8 +201,8 @@ type stubAWSSecretsAPI struct {
getSecretValueErr error
}
func (s stubAWSSecretsAPI) GetSecretValue(ctx context.Context, params *awssecretmanager.GetSecretValueInput,
optFns ...func(*awssecretmanager.Options),
func (s stubAWSSecretsAPI) GetSecretValue(_ context.Context, _ *awssecretmanager.GetSecretValueInput,
_ ...func(*awssecretmanager.Options),
) (*awssecretmanager.GetSecretValueOutput, error) {
return s.getSecretValueResp, s.getSecretValueErr
}

View File

@ -176,18 +176,18 @@ type stubMetadata struct {
uidErr error
}
func (m *stubMetadata) List(ctx context.Context) ([]metadata.InstanceMetadata, error) {
func (m *stubMetadata) List(_ context.Context) ([]metadata.InstanceMetadata, error) {
return m.listRes, m.listErr
}
func (m *stubMetadata) Self(ctx context.Context) (metadata.InstanceMetadata, error) {
func (m *stubMetadata) Self(_ context.Context) (metadata.InstanceMetadata, error) {
return m.selfRes, m.selfErr
}
func (m *stubMetadata) GetLoadBalancerEndpoint(ctx context.Context) (string, error) {
func (m *stubMetadata) GetLoadBalancerEndpoint(_ context.Context) (string, error) {
return m.getLBEndpointRes, m.getLBEndpointErr
}
func (m *stubMetadata) UID(context.Context) (string, error) {
func (m *stubMetadata) UID(_ context.Context) (string, error) {
return m.uid, m.uidErr
}

View File

@ -93,7 +93,7 @@ type stubFetcher struct {
discoverCalls int
}
func (s *stubFetcher) DiscoverDebugdIPs(ctx context.Context) ([]string, error) {
func (s *stubFetcher) DiscoverDebugdIPs(_ context.Context) ([]string, error) {
s.discoverCalls++
var err error
if s.discoverErrIdx < len(s.discoverErrs) {
@ -113,7 +113,7 @@ type stubDownloader struct {
downloadInfoIPs []string
}
func (s *stubDownloader) DownloadDeployment(ctx context.Context, ip string) error {
func (s *stubDownloader) DownloadDeployment(_ context.Context, ip string) error {
s.downloadDeploymentIPs = append(s.downloadDeploymentIPs, ip)
var err error
if s.downloadDeploymentErrIdx < len(s.downloadDeploymentErrs) {
@ -123,7 +123,7 @@ func (s *stubDownloader) DownloadDeployment(ctx context.Context, ip string) erro
return err
}
func (s *stubDownloader) DownloadInfo(ctx context.Context, ip string) error {
func (s *stubDownloader) DownloadInfo(_ context.Context, ip string) error {
s.downloadInfoIPs = append(s.downloadInfoIPs, ip)
var err error
if s.downloadInfoErrIdx < len(s.downloadInfoErrs) {

View File

@ -46,7 +46,7 @@ func New(log *logger.Logger, serviceManager serviceManager, transfer fileTransfe
}
// SetInfo sets the info of the debugd instance.
func (s *debugdServer) SetInfo(ctx context.Context, req *pb.SetInfoRequest) (*pb.SetInfoResponse, error) {
func (s *debugdServer) SetInfo(_ context.Context, req *pb.SetInfoRequest) (*pb.SetInfoResponse, error) {
s.log.Infof("Received SetInfo request")
if len(req.Info) == 0 {
@ -73,7 +73,7 @@ func (s *debugdServer) SetInfo(ctx context.Context, req *pb.SetInfoRequest) (*pb
}
// GetInfo returns the info of the debugd instance.
func (s *debugdServer) GetInfo(ctx context.Context, req *pb.GetInfoRequest) (*pb.GetInfoResponse, error) {
func (s *debugdServer) GetInfo(_ context.Context, _ *pb.GetInfoRequest) (*pb.GetInfoResponse, error) {
s.log.Infof("Received GetInfo request")
info, err := s.info.GetProto()
@ -131,7 +131,7 @@ func (s *debugdServer) UploadFiles(stream pb.Debugd_UploadFilesServer) error {
}
// DownloadFiles streams the previously received files to other instances.
func (s *debugdServer) DownloadFiles(request *pb.DownloadFilesRequest, stream pb.Debugd_DownloadFilesServer) error {
func (s *debugdServer) DownloadFiles(_ *pb.DownloadFilesRequest, stream pb.Debugd_DownloadFilesServer) error {
s.log.Infof("Sending files to other instance")
if !s.transfer.CanSend() {
return errors.New("cannot send files at this time")

View File

@ -354,17 +354,17 @@ type stubServiceManager struct {
overrideServiceUnitExecStartErr error
}
func (s *stubServiceManager) SystemdAction(ctx context.Context, request deploy.ServiceManagerRequest) error {
func (s *stubServiceManager) SystemdAction(_ context.Context, request deploy.ServiceManagerRequest) error {
s.requests = append(s.requests, request)
return s.systemdActionErr
}
func (s *stubServiceManager) WriteSystemdUnitFile(ctx context.Context, unit deploy.SystemdUnit) error {
func (s *stubServiceManager) WriteSystemdUnitFile(_ context.Context, unit deploy.SystemdUnit) error {
s.unitFiles = append(s.unitFiles, unit)
return s.writeSystemdUnitFileErr
}
func (s *stubServiceManager) OverrideServiceUnitExecStart(ctx context.Context, unitName string, execStart string) error {
func (s *stubServiceManager) OverrideServiceUnitExecStart(_ context.Context, unitName string, execStart string) error {
s.overrideCalls = append(s.overrideCalls, struct {
UnitName, ExecStart string
}{UnitName: unitName, ExecStart: execStart})
@ -372,7 +372,7 @@ func (s *stubServiceManager) OverrideServiceUnitExecStart(ctx context.Context, u
}
type netDialer interface {
DialContext(ctx context.Context, network, address string) (net.Conn, error)
DialContext(_ context.Context, network, address string) (net.Conn, error)
}
func dial(ctx context.Context, dialer netDialer, target string) (*grpc.ClientConn, error) {

View File

@ -368,11 +368,11 @@ type stubStreamReadWriter struct {
writeStreamErr error
}
func (s *stubStreamReadWriter) ReadStream(filename string, _ streamer.WriteChunkStream, _ uint, _ bool) error {
func (s *stubStreamReadWriter) ReadStream(_ string, _ streamer.WriteChunkStream, _ uint, _ bool) error {
return s.readStreamErr
}
func (s *stubStreamReadWriter) WriteStream(filename string, _ streamer.ReadChunkStream, _ bool) error {
func (s *stubStreamReadWriter) WriteStream(_ string, _ streamer.ReadChunkStream, _ bool) error {
return s.writeStreamErr
}

View File

@ -159,7 +159,7 @@ type stubKMS struct {
getDEKErr error
}
func (s *stubKMS) GetDEK(ctx context.Context, dekID string, dekSize int) ([]byte, error) {
func (s *stubKMS) GetDEK(_ context.Context, _ string, _ int) ([]byte, error) {
if s.getDEKErr != nil {
return nil, s.getDEKErr
}

View File

@ -421,17 +421,17 @@ type stubMounter struct {
mkdirAllErr error
}
func (s *stubMounter) Mount(source string, target string, fstype string, flags uintptr, data string) error {
func (s *stubMounter) Mount(_ string, _ string, _ string, _ uintptr, _ string) error {
s.mountCalled = true
return s.mountErr
}
func (s *stubMounter) Unmount(target string, flags int) error {
func (s *stubMounter) Unmount(_ string, _ int) error {
s.unmountCalled = true
return s.unmountErr
}
func (s *stubMounter) MkdirAll(path string, perm fs.FileMode) error {
func (s *stubMounter) MkdirAll(_ string, _ fs.FileMode) error {
return s.mkdirAllErr
}
@ -441,7 +441,7 @@ type stubRecoveryDoer struct {
recoveryErr error
}
func (s *stubRecoveryDoer) Do(uuid, endpoint string) (passphrase, measurementSecret []byte, err error) {
func (s *stubRecoveryDoer) Do(_, _ string) (passphrase, measurementSecret []byte, err error) {
return s.passphrase, s.secret, s.recoveryErr
}
@ -449,6 +449,6 @@ type stubConfigurationGenerator struct {
generateErr error
}
func (s *stubConfigurationGenerator) Generate(volumeName, encryptedDevice, keyFile, options string) error {
func (s *stubConfigurationGenerator) Generate(_, _, _, _ string) error {
return s.generateErr
}

View File

@ -340,7 +340,7 @@ type stubConnect struct {
getNetworkErr error
}
func (c stubConnect) LookupNetworkByName(name string) (*virtwrapper.Network, error) {
func (c stubConnect) LookupNetworkByName(_ string) (*virtwrapper.Network, error) {
return &virtwrapper.Network{Net: c.network}, c.getNetworkErr
}

View File

@ -44,7 +44,7 @@ func NewValidator(pcrs measurements.M, log vtpm.AttestationLogger) *Validator {
// getTrustedKeys return the public area of the provides attestation key.
// Normally, here the trust of this key should be verified, but currently AWS does not provide this feature.
func getTrustedKey(akPub []byte, instanceInfo []byte) (crypto.PublicKey, error) {
func getTrustedKey(akPub []byte, _ []byte) (crypto.PublicKey, error) {
// Copied from https://github.com/edgelesssys/constellation/blob/main/internal/attestation/qemu/validator.go
pubArea, err := tpm2.DecodePublic(akPub)
if err != nil {

View File

@ -124,7 +124,7 @@ type stubDescribeAPI struct {
}
func (a *stubDescribeAPI) DescribeImages(
ctx context.Context, params *ec2.DescribeImagesInput, optFns ...func(*ec2.Options),
_ context.Context, _ *ec2.DescribeImagesInput, _ ...func(*ec2.Options),
) (*ec2.DescribeImagesOutput, error) {
output := &ec2.DescribeImagesOutput{
Images: []types.Image{

View File

@ -131,7 +131,7 @@ type stubImdsClient struct {
apiError error
}
func (c stubImdsClient) getVcek(ctx context.Context) (vcekResponse, error) {
func (c stubImdsClient) getVcek(_ context.Context) (vcekResponse, error) {
if c.apiError != nil {
return vcekResponse{}, c.apiError
}
@ -147,7 +147,7 @@ type stubTpmReport struct {
err error
}
func (s *stubTpmReport) get(tpm io.ReadWriteCloser) ([]byte, error) {
func (s *stubTpmReport) get(_ io.ReadWriteCloser) ([]byte, error) {
if s.err != nil {
return nil, s.err
}

View File

@ -371,7 +371,7 @@ func newStubAzureInstanceInfo(vcek string, certChain string, report string, runt
}, nil
}
func (s *stubAzureInstanceInfo) validateAk(runtimeDataRaw []byte, reportData []byte, rsaParameters *tpm2.RSAParams) error {
func (s *stubAzureInstanceInfo) validateAk(runtimeDataRaw []byte, reportData []byte, _ *tpm2.RSAParams) error {
var runtimeData runtimeData
if err := json.Unmarshal(runtimeDataRaw, &runtimeData); err != nil {
return fmt.Errorf("unmarshalling json: %w", err)

View File

@ -183,6 +183,6 @@ func (c *fakeInstanceClient) Close() error {
return nil
}
func (c *fakeInstanceClient) GetShieldedInstanceIdentity(ctx context.Context, req *computepb.GetShieldedInstanceIdentityInstanceRequest, opts ...gax.CallOption) (*computepb.ShieldedInstanceIdentity, error) {
func (c *fakeInstanceClient) GetShieldedInstanceIdentity(_ context.Context, _ *computepb.GetShieldedInstanceIdentityInstanceRequest, _ ...gax.CallOption) (*computepb.ShieldedInstanceIdentity, error) {
return c.ident, c.getIdentErr
}

View File

@ -35,7 +35,7 @@ func NewValidator(pcrs measurements.M, log vtpm.AttestationLogger) *Validator {
}
// unconditionalTrust returns the given public key as the trusted attestation key.
func unconditionalTrust(akPub, instanceInfo []byte) (crypto.PublicKey, error) {
func unconditionalTrust(akPub, _ []byte) (crypto.PublicKey, error) {
pubArea, err := tpm2.DecodePublic(akPub)
if err != nil {
return nil, err

View File

@ -51,7 +51,7 @@ func (s simTPMWithEventLog) EventLog() ([]byte, error) {
return header, nil
}
func fakeGetInstanceInfo(tpm io.ReadWriteCloser) ([]byte, error) {
func fakeGetInstanceInfo(_ io.ReadWriteCloser) ([]byte, error) {
return []byte("unit-test"), nil
}

View File

@ -739,7 +739,7 @@ type stubLoadbalancer struct {
}
func (s *stubLoadbalancer) DescribeLoadBalancers(_ context.Context,
in *elasticloadbalancingv2.DescribeLoadBalancersInput,
_ *elasticloadbalancingv2.DescribeLoadBalancersInput,
_ ...func(*elasticloadbalancingv2.Options)) (
*elasticloadbalancingv2.DescribeLoadBalancersOutput, error,
) {

View File

@ -1025,27 +1025,27 @@ type stubIMDSAPI struct {
initSecretHashErr error
}
func (a *stubIMDSAPI) providerID(ctx context.Context) (string, error) {
func (a *stubIMDSAPI) providerID(_ context.Context) (string, error) {
return a.providerIDVal, a.providerIDErr
}
func (a *stubIMDSAPI) subscriptionID(ctx context.Context) (string, error) {
func (a *stubIMDSAPI) subscriptionID(_ context.Context) (string, error) {
return a.subscriptionIDVal, a.subscriptionIDErr
}
func (a *stubIMDSAPI) resourceGroup(ctx context.Context) (string, error) {
func (a *stubIMDSAPI) resourceGroup(_ context.Context) (string, error) {
return a.resourceGroupVal, a.resourceGroupErr
}
func (a *stubIMDSAPI) uid(ctx context.Context) (string, error) {
func (a *stubIMDSAPI) uid(_ context.Context) (string, error) {
return a.uidVal, a.uidErr
}
func (a *stubIMDSAPI) name(ctx context.Context) (string, error) {
func (a *stubIMDSAPI) name(_ context.Context) (string, error) {
return a.nameVal, a.nameErr
}
func (a *stubIMDSAPI) initSecretHash(ctx context.Context) (string, error) {
func (a *stubIMDSAPI) initSecretHash(_ context.Context) (string, error) {
return a.initSecretHashVal, a.initSecretHashErr
}
@ -1265,7 +1265,7 @@ type stubLoadBalancersAPI struct {
pager *stubLoadBalancersClientListPager
}
func (a *stubLoadBalancersAPI) NewListPager(resourceGroupName string, options *armnetwork.LoadBalancersClientListOptions,
func (a *stubLoadBalancersAPI) NewListPager(_ string, _ *armnetwork.LoadBalancersClientListOptions,
) *runtime.Pager[armnetwork.LoadBalancersClientListResponse] {
return runtime.NewPager(runtime.PagingHandler[armnetwork.LoadBalancersClientListResponse]{
More: a.pager.moreFunc(),

View File

@ -257,11 +257,11 @@ type httpBufconnServer struct {
*bufconn.Listener
}
func (s *httpBufconnServer) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
func (s *httpBufconnServer) DialContext(ctx context.Context, _, _ string) (net.Conn, error) {
return s.Listener.DialContext(ctx)
}
func (s *httpBufconnServer) Dial(network, addr string) (net.Conn, error) {
func (s *httpBufconnServer) Dial(_, _ string) (net.Conn, error) {
return s.Listener.Dial()
}

View File

@ -176,7 +176,7 @@ type stubApplicationsInsightsAPI struct {
pager *stubApplicationKeyPager
}
func (a *stubApplicationsInsightsAPI) NewListByResourceGroupPager(resourceGroupName string, options *armapplicationinsights.ComponentsClientListByResourceGroupOptions,
func (a *stubApplicationsInsightsAPI) NewListByResourceGroupPager(_ string, _ *armapplicationinsights.ComponentsClientListByResourceGroupOptions,
) *runtime.Pager[armapplicationinsights.ComponentsClientListByResourceGroupResponse] {
return runtime.NewPager(runtime.PagingHandler[armapplicationinsights.ComponentsClientListByResourceGroupResponse]{
More: a.pager.moreFunc(),

View File

@ -236,7 +236,7 @@ func (c *Cloud) List(ctx context.Context) ([]metadata.InstanceMetadata, error) {
}
// ProviderID returns the providerID of the current instance.
func (c *Cloud) ProviderID(ctx context.Context) (string, error) {
func (c *Cloud) ProviderID(_ context.Context) (string, error) {
project, zone, instanceName, err := c.retrieveInstanceInfo()
if err != nil {
return "", err

View File

@ -960,7 +960,7 @@ type stubGlobalForwardingRulesAPI struct {
}
func (s *stubGlobalForwardingRulesAPI) List(
ctx context.Context, req *computepb.ListGlobalForwardingRulesRequest, opts ...gax.CallOption,
_ context.Context, _ *computepb.ListGlobalForwardingRulesRequest, _ ...gax.CallOption,
) forwardingRuleIterator {
return s.iterator
}
@ -972,7 +972,7 @@ type stubRegionalForwardingRulesAPI struct {
}
func (s *stubRegionalForwardingRulesAPI) List(
ctx context.Context, req *computepb.ListForwardingRulesRequest, opts ...gax.CallOption,
_ context.Context, _ *computepb.ListForwardingRulesRequest, _ ...gax.CallOption,
) forwardingRuleIterator {
return s.iterator
}
@ -1022,13 +1022,13 @@ type stubInstanceAPI struct {
}
func (s *stubInstanceAPI) Get(
ctx context.Context, req *computepb.GetInstanceRequest, opts ...gax.CallOption,
_ context.Context, _ *computepb.GetInstanceRequest, _ ...gax.CallOption,
) (*computepb.Instance, error) {
return s.instance, s.instanceErr
}
func (s *stubInstanceAPI) List(
ctx context.Context, req *computepb.ListInstancesRequest, opts ...gax.CallOption,
_ context.Context, _ *computepb.ListInstancesRequest, _ ...gax.CallOption,
) instanceIterator {
return s.iterator
}
@ -1058,7 +1058,7 @@ type stubSubnetAPI struct {
}
func (s *stubSubnetAPI) Get(
ctx context.Context, req *computepb.GetSubnetworkRequest, opts ...gax.CallOption,
_ context.Context, _ *computepb.GetSubnetworkRequest, _ ...gax.CallOption,
) (*computepb.Subnetwork, error) {
return s.subnet, s.subnetErr
}

View File

@ -31,7 +31,7 @@ func (c *globalForwardingRulesClient) Close() error {
}
func (c *globalForwardingRulesClient) List(ctx context.Context, req *computepb.ListGlobalForwardingRulesRequest,
opts ...gax.CallOption,
_ ...gax.CallOption,
) forwardingRuleIterator {
return c.GlobalForwardingRulesClient.List(ctx, req)
}
@ -45,7 +45,7 @@ func (c *regionalForwardingRulesClient) Close() error {
}
func (c *regionalForwardingRulesClient) List(ctx context.Context, req *computepb.ListForwardingRulesRequest,
opts ...gax.CallOption,
_ ...gax.CallOption,
) forwardingRuleIterator {
return c.ForwardingRulesClient.List(ctx, req)
}
@ -59,7 +59,7 @@ func (c *instanceClient) Close() error {
}
func (c *instanceClient) List(ctx context.Context, req *computepb.ListInstancesRequest,
opts ...gax.CallOption,
_ ...gax.CallOption,
) instanceIterator {
return c.InstancesClient.List(ctx, req)
}

View File

@ -32,31 +32,31 @@ type stubIMDSClient struct {
vpcIPErr error
}
func (c *stubIMDSClient) providerID(ctx context.Context) (string, error) {
func (c *stubIMDSClient) providerID(_ context.Context) (string, error) {
return c.providerIDResult, c.providerIDErr
}
func (c *stubIMDSClient) name(ctx context.Context) (string, error) {
func (c *stubIMDSClient) name(_ context.Context) (string, error) {
return c.nameResult, c.nameErr
}
func (c *stubIMDSClient) projectID(ctx context.Context) (string, error) {
func (c *stubIMDSClient) projectID(_ context.Context) (string, error) {
return c.projectIDResult, c.projectIDErr
}
func (c *stubIMDSClient) uid(ctx context.Context) (string, error) {
func (c *stubIMDSClient) uid(_ context.Context) (string, error) {
return c.uidResult, c.uidErr
}
func (c *stubIMDSClient) initSecretHash(ctx context.Context) (string, error) {
func (c *stubIMDSClient) initSecretHash(_ context.Context) (string, error) {
return c.initSecretHashResult, c.initSecretHashErr
}
func (c *stubIMDSClient) role(ctx context.Context) (role.Role, error) {
func (c *stubIMDSClient) role(_ context.Context) (role.Role, error) {
return c.roleResult, c.roleErr
}
func (c *stubIMDSClient) vpcIP(ctx context.Context) (string, error) {
func (c *stubIMDSClient) vpcIP(_ context.Context) (string, error) {
return c.vpcIPResult, c.vpcIPErr
}
@ -65,11 +65,11 @@ type stubServersClient struct {
subnetsPager stubPager
}
func (c *stubServersClient) ListServers(opts servers.ListOptsBuilder) pagerAPI {
func (c *stubServersClient) ListServers(_ servers.ListOptsBuilder) pagerAPI {
return &c.serversPager
}
func (c *stubServersClient) ListSubnets(opts subnets.ListOpts) pagerAPI {
func (c *stubServersClient) ListSubnets(_ subnets.ListOpts) pagerAPI {
return &c.subnetsPager
}

View File

@ -383,7 +383,7 @@ func newStubHTTPClientJSONFunc(response metadataResponse, err error) httpClientJ
}
}
func (c *stubHTTPClientJSON) Do(req *http.Request) (*http.Response, error) {
func (c *stubHTTPClientJSON) Do(_ *http.Request) (*http.Response, error) {
c.called = true
body, err := json.Marshal(c.response)
c.require.NoError(err)
@ -396,7 +396,7 @@ type stubHTTPClient struct {
called bool
}
func (c *stubHTTPClient) Do(req *http.Request) (*http.Response, error) {
func (c *stubHTTPClient) Do(_ *http.Request) (*http.Response, error) {
c.called = true
return &http.Response{Body: io.NopCloser(strings.NewReader(c.response))}, c.err
}

View File

@ -76,7 +76,7 @@ func (c *Cloud) InitSecretHash(ctx context.Context) ([]byte, error) {
}
// UID returns the UID of the constellation.
func (c *Cloud) UID(ctx context.Context) (string, error) {
func (c *Cloud) UID(_ context.Context) (string, error) {
// We expect only one constellation to be deployed in the same QEMU / libvirt environment.
// the UID can be an empty string.
return "", nil

View File

@ -419,7 +419,7 @@ func validateVersionCompatibilityHelper(binaryVersion, fieldName, configuredVers
return compatibility.BinaryWith(binaryVersion, configuredVersion)
}
func returnsTrue(fl validator.FieldLevel) bool {
func returnsTrue(_ validator.FieldLevel) bool {
return true
}
@ -472,13 +472,13 @@ func registerValidAttestVariantError(ut ut.Translator) error {
return ut.Add("valid_attestation_variant", `"{0}" is not a valid attestation variant for CSP {1}`, true)
}
func (c *Config) translateValidAttestVariantError(ut ut.Translator, fe validator.FieldError) string {
func (c *Config) translateValidAttestVariantError(ut ut.Translator, _ validator.FieldError) string {
csp := c.GetProvider()
t, _ := ut.T("valid_attestation_variant", c.AttestationVariant, csp.String())
return t
}
func (c *Config) validAttestVariant(fl validator.FieldLevel) bool {
func (c *Config) validAttestVariant(_ validator.FieldLevel) bool {
// TODO: v2.8: remove variant fallback and make variant a required field
c.addMissingVariant()

View File

@ -62,6 +62,6 @@ func (c *Credentials) Clone() credentials.TransportCredentials {
}
// OverrideServerName is not supported and will fail.
func (c *Credentials) OverrideServerName(s string) error {
func (c *Credentials) OverrideServerName(_ string) error {
return errors.New("cannot override server name")
}

View File

@ -121,6 +121,6 @@ type fakeAPI struct {
initproto.UnimplementedAPIServer
}
func (f *fakeAPI) Init(ctx context.Context, in *initproto.InitRequest) (*initproto.InitResponse, error) {
func (f *fakeAPI) Init(_ context.Context, _ *initproto.InitRequest) (*initproto.InitResponse, error) {
return &initproto.InitResponse{}, nil
}

View File

@ -109,6 +109,6 @@ type testAPI struct {
grpc_testing.UnimplementedTestServiceServer
}
func (s *testAPI) EmptyCall(ctx context.Context, in *grpc_testing.Empty) (*grpc_testing.Empty, error) {
func (s *testAPI) EmptyCall(_ context.Context, _ *grpc_testing.Empty) (*grpc_testing.Empty, error) {
return &grpc_testing.Empty{}, nil
}

View File

@ -28,7 +28,7 @@ func NewBufconnDialer() *BufconnDialer {
}
// DialContext implements the Dialer interface.
func (b *BufconnDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
func (b *BufconnDialer) DialContext(ctx context.Context, _, address string) (net.Conn, error) {
b.mut.Lock()
listener, ok := b.listeners[address]
b.mut.Unlock()

View File

@ -555,11 +555,11 @@ type httpBufconnServer struct {
*bufconn.Listener
}
func (s *httpBufconnServer) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
func (s *httpBufconnServer) DialContext(ctx context.Context, _, _ string) (net.Conn, error) {
return s.Listener.DialContext(ctx)
}
func (s *httpBufconnServer) Dial(network, addr string) (net.Conn, error) {
func (s *httpBufconnServer) Dial(_, _ string) (net.Conn, error) {
return s.Listener.Dial()
}

View File

@ -41,7 +41,7 @@ func New(key []byte, salt []byte) (*KMS, error) {
}
// GetDEK derives a key from the KMS masterKey.
func (c *KMS) GetDEK(ctx context.Context, dekID string, dekSize int) ([]byte, error) {
func (c *KMS) GetDEK(_ context.Context, dekID string, dekSize int) ([]byte, error) {
if len(c.masterKey) == 0 {
return nil, errors.New("master key not set for Constellation KMS")
}

View File

@ -33,7 +33,7 @@ type KMSClient struct {
}
// New initializes a KMS client for Google Cloud Platform.
func New(ctx context.Context, store kmsInterface.Storage, cfg uri.GCPConfig) (*KMSClient, error) {
func New(_ context.Context, store kmsInterface.Storage, cfg uri.GCPConfig) (*KMSClient, error) {
if store == nil {
return nil, errors.New("no storage backend provided for KMS")
}

View File

@ -28,13 +28,13 @@ type stubAWSS3StorageClient struct {
createBucketErr error
}
func (s *stubAWSS3StorageClient) GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error) {
func (s *stubAWSS3StorageClient) GetObject(_ context.Context, _ *s3.GetObjectInput, _ ...func(*s3.Options)) (*s3.GetObjectOutput, error) {
return &s3.GetObjectOutput{
Body: io.NopCloser(bytes.NewReader(s.getObjectOutputData)),
}, s.getObjectErr
}
func (s *stubAWSS3StorageClient) PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error) {
func (s *stubAWSS3StorageClient) PutObject(_ context.Context, params *s3.PutObjectInput, _ ...func(*s3.Options)) (*s3.PutObjectOutput, error) {
out, err := io.ReadAll(params.Body)
if err != nil {
panic(err)
@ -43,7 +43,7 @@ func (s *stubAWSS3StorageClient) PutObject(ctx context.Context, params *s3.PutOb
return &s3.PutObjectOutput{}, s.putObjectErr
}
func (s *stubAWSS3StorageClient) CreateBucket(ctx context.Context, params *s3.CreateBucketInput, optFns ...func(*s3.Options)) (*s3.CreateBucketOutput, error) {
func (s *stubAWSS3StorageClient) CreateBucket(_ context.Context, _ *s3.CreateBucketInput, _ ...func(*s3.Options)) (*s3.CreateBucketOutput, error) {
s.createBucketCalled = true
return &s3.CreateBucketOutput{}, s.createBucketErr
}

View File

@ -28,11 +28,11 @@ type stubGCPStorageAPI struct {
writer *stubWriteCloser
}
func (s *stubGCPStorageAPI) stubClientFactory(ctx context.Context) (gcpStorageAPI, error) {
func (s *stubGCPStorageAPI) stubClientFactory(_ context.Context) (gcpStorageAPI, error) {
return s, s.newClientErr
}
func (s *stubGCPStorageAPI) Attrs(ctx context.Context, bucketName string) (*gcstorage.BucketAttrs, error) {
func (s *stubGCPStorageAPI) Attrs(_ context.Context, _ string) (*gcstorage.BucketAttrs, error) {
return &gcstorage.BucketAttrs{}, s.attrsErr
}
@ -40,16 +40,16 @@ func (s *stubGCPStorageAPI) Close() error {
return nil
}
func (s *stubGCPStorageAPI) CreateBucket(ctx context.Context, bucketName, projectID string, attrs *gcstorage.BucketAttrs) error {
func (s *stubGCPStorageAPI) CreateBucket(_ context.Context, _, _ string, _ *gcstorage.BucketAttrs) error {
s.createBucketCalled = true
return s.createBucketErr
}
func (s *stubGCPStorageAPI) NewWriter(ctx context.Context, bucketName, objectName string) io.WriteCloser {
func (s *stubGCPStorageAPI) NewWriter(_ context.Context, _, _ string) io.WriteCloser {
return s.writer
}
func (s *stubGCPStorageAPI) NewReader(ctx context.Context, bucketName, objectName string) (io.ReadCloser, error) {
func (s *stubGCPStorageAPI) NewReader(_ context.Context, _, _ string) (io.ReadCloser, error) {
return io.NopCloser(bytes.NewReader(s.newReaderOutput)), s.newReaderErr
}

View File

@ -29,7 +29,7 @@ func New() *Storage {
}
// Get returns a DEK from Storage by key ID.
func (s *Storage) Get(ctx context.Context, keyID string) ([]byte, error) {
func (s *Storage) Get(_ context.Context, keyID string) ([]byte, error) {
encDEK, ok := s.dekPool[keyID]
if ok {
return encDEK, nil
@ -38,7 +38,7 @@ func (s *Storage) Get(ctx context.Context, keyID string) ([]byte, error) {
}
// Put saves a DEK to Storage by key ID.
func (s *Storage) Put(ctx context.Context, keyID string, encDEK []byte) error {
func (s *Storage) Put(_ context.Context, keyID string, encDEK []byte) error {
s.dekPool[keyID] = encDEK
return nil
}

View File

@ -20,11 +20,11 @@ import (
type Checker struct{}
// NewChecker creates a new Checker.
func NewChecker(quotaChecker QuotaChecker, fileHandler file.Handler) *Checker {
func NewChecker(_ QuotaChecker, _ file.Handler) *Checker {
return &Checker{}
}
// CheckLicense is a no-op for open source version of Constellation.
func (c *Checker) CheckLicense(ctx context.Context, provider cloudprovider.Provider, providerCfg config.ProviderConfig, printer func(string, ...any)) error {
func (c *Checker) CheckLicense(_ context.Context, _ cloudprovider.Provider, _ config.ProviderConfig, _ func(string, ...any)) error {
return nil
}

View File

@ -58,7 +58,7 @@ func IsSupportedK8sVersion(version string) bool {
}
// IsPreviewK8sVersion checks if a given Kubernetes version is still in preview and not fully supported.
func IsPreviewK8sVersion(version ValidK8sVersion) bool {
func IsPreviewK8sVersion(_ ValidK8sVersion) bool {
return false
}

View File

@ -47,7 +47,7 @@ If you've build a local image, use a local override instead of adding a new vers
return cmd
}
func runAdd(cmd *cobra.Command, args []string) (retErr error) {
func runAdd(cmd *cobra.Command, _ []string) (retErr error) {
flags, err := parseAddFlags(cmd)
if err != nil {
return err

View File

@ -33,7 +33,7 @@ func newLatestCmd() *cobra.Command {
return cmd
}
func runLatest(cmd *cobra.Command, args []string) error {
func runLatest(cmd *cobra.Command, _ []string) error {
flags, err := parseLatestFlags(cmd)
if err != nil {
return err

View File

@ -37,7 +37,7 @@ func newListCmd() *cobra.Command {
return cmd
}
func runList(cmd *cobra.Command, args []string) error {
func runList(cmd *cobra.Command, _ []string) error {
flags, err := parseListFlags(cmd)
if err != nil {
return err

View File

@ -89,7 +89,7 @@ func signalContext(ctx context.Context, sig os.Signal) (context.Context, context
return sigCtx, cancelFunc
}
func preRunRoot(cmd *cobra.Command, args []string) {
func preRunRoot(cmd *cobra.Command, _ []string) {
cmd.SilenceUsage = true
}

View File

@ -69,7 +69,7 @@ Most developers won't have the required permissions to use this command.
return cmd
}
func runRemove(cmd *cobra.Command, args []string) (retErr error) {
func runRemove(cmd *cobra.Command, _ []string) (retErr error) {
flags, err := parseRmFlags(cmd)
if err != nil {
return err
@ -89,7 +89,7 @@ func runRemove(cmd *cobra.Command, args []string) (retErr error) {
}
log.Debugf("Creating AWS client")
awsClient, err := newAWSClient(cmd.Context(), flags.region)
awsClient, err := newAWSClient()
if err != nil {
return fmt.Errorf("creating AWS client: %w", err)
}
@ -393,7 +393,7 @@ type awsClient struct {
// newAWSClient creates a new awsClient.
// Requires IAM permission 'ec2:DeregisterImage'.
func newAWSClient(ctx context.Context, region string) (*awsClient, error) {
func newAWSClient() (*awsClient, error) {
return &awsClient{}, nil
}

View File

@ -160,7 +160,7 @@ type testWatcher struct {
errors chan error
}
func (w *testWatcher) Add(path string) error {
func (w *testWatcher) Add(_ string) error {
w.addCalled++
return w.addErr
}

View File

@ -277,11 +277,11 @@ type stubCA struct {
getNameErr error
}
func (f stubCA) GetCertificate(csr []byte) ([]byte, error) {
func (f stubCA) GetCertificate(_ []byte) ([]byte, error) {
return f.cert, f.getCertErr
}
func (f stubCA) GetNodeNameFromCSR(csr []byte) (string, error) {
func (f stubCA) GetNodeNameFromCSR(_ []byte) (string, error) {
return f.nodeName, f.getNameErr
}
@ -297,15 +297,15 @@ type stubKubeClient struct {
componentsRef string
}
func (s *stubKubeClient) GetK8sComponentsRefFromNodeVersionCRD(ctx context.Context, nodeName string) (string, error) {
func (s *stubKubeClient) GetK8sComponentsRefFromNodeVersionCRD(_ context.Context, _ string) (string, error) {
return s.getK8sComponentsRefFromNodeVersionCRDVal, s.getK8sComponentsRefFromNodeVersionCRDErr
}
func (s *stubKubeClient) GetComponents(ctx context.Context, configMapName string) (components.Components, error) {
func (s *stubKubeClient) GetComponents(_ context.Context, _ string) (components.Components, error) {
return s.getComponentsVal, s.getComponentsErr
}
func (s *stubKubeClient) AddNodeToJoiningNodes(ctx context.Context, nodeName string, componentsRef string, isControlPlane bool) error {
func (s *stubKubeClient) AddNodeToJoiningNodes(_ context.Context, nodeName string, componentsRef string, _ bool) error {
s.joiningNodeName = nodeName
s.componentsRef = componentsRef
return s.addNodeToJoiningNodesErr

View File

@ -60,12 +60,12 @@ type stubKMS struct {
deriveKeyErr error
}
func (c *stubKMS) CreateKEK(ctx context.Context, keyID string, kek []byte) error {
func (c *stubKMS) CreateKEK(_ context.Context, _ string, kek []byte) error {
c.masterKey = kek
return nil
}
func (c *stubKMS) GetDEK(ctx context.Context, dekID string, dekSize int) ([]byte, error) {
func (c *stubKMS) GetDEK(_ context.Context, _ string, _ int) ([]byte, error) {
if c.deriveKeyErr != nil {
return nil, c.deriveKeyErr
}

View File

@ -50,7 +50,7 @@ func newStubReaderClient(t *testing.T, objects []runtime.Object, getErr, listErr
}
}
func (c *stubReaderClient) Get(_ context.Context, key client.ObjectKey, out client.Object, opts ...client.GetOption) error {
func (c *stubReaderClient) Get(_ context.Context, key client.ObjectKey, out client.Object, _ ...client.GetOption) error {
gvks, _, err := c.scheme.ObjectKinds(out)
if err != nil {
panic(err)
@ -71,7 +71,7 @@ func (c *stubReaderClient) Get(_ context.Context, key client.ObjectKey, out clie
return c.getErr
}
func (c *stubReaderClient) List(_ context.Context, out client.ObjectList, opts ...client.ListOption) error {
func (c *stubReaderClient) List(_ context.Context, out client.ObjectList, _ ...client.ListOption) error {
gvks, _, err := c.scheme.ObjectKinds(out)
if err != nil {
panic(err)
@ -102,23 +102,23 @@ type stubWriterClient struct {
client.Client
}
func (c *stubWriterClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error {
func (c *stubWriterClient) Create(_ context.Context, _ client.Object, _ ...client.CreateOption) error {
return c.createErr
}
func (c *stubWriterClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error {
func (c *stubWriterClient) Delete(_ context.Context, _ client.Object, _ ...client.DeleteOption) error {
return c.deleteErr
}
func (c *stubWriterClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error {
func (c *stubWriterClient) Update(_ context.Context, _ client.Object, _ ...client.UpdateOption) error {
return c.updateErr
}
func (c *stubWriterClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error {
func (c *stubWriterClient) Patch(_ context.Context, _ client.Object, _ client.Patch, _ ...client.PatchOption) error {
return c.patchErr
}
func (c *stubWriterClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error {
func (c *stubWriterClient) DeleteAllOf(_ context.Context, _ client.Object, _ ...client.DeleteAllOfOption) error {
return c.deleteAllOfErr
}
@ -170,14 +170,14 @@ type stubStatusWriter struct {
patchErr error
}
func (w *stubStatusWriter) Create(ctx context.Context, obj client.Object, subResource client.Object, opts ...client.SubResourceCreateOption) error {
func (w *stubStatusWriter) Create(_ context.Context, _ client.Object, _ client.Object, _ ...client.SubResourceCreateOption) error {
return w.createErr
}
func (w *stubStatusWriter) Update(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error {
func (w *stubStatusWriter) Update(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error {
return w.updateErr
}
func (w *stubStatusWriter) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.SubResourcePatchOption) error {
func (w *stubStatusWriter) Patch(_ context.Context, _ client.Object, _ client.Patch, _ ...client.SubResourcePatchOption) error {
return w.patchErr
}

View File

@ -764,25 +764,25 @@ type stubNodeReplacer struct {
deleteErr error
}
func (r *stubNodeReplacer) GetNodeImage(ctx context.Context, providerID string) (string, error) {
func (r *stubNodeReplacer) GetNodeImage(_ context.Context, providerID string) (string, error) {
r.RLock()
defer r.RUnlock()
return r.nodeImages[providerID], r.nodeImageErr
}
func (r *stubNodeReplacer) GetScalingGroupID(ctx context.Context, providerID string) (string, error) {
func (r *stubNodeReplacer) GetScalingGroupID(_ context.Context, providerID string) (string, error) {
r.RLock()
defer r.RUnlock()
return r.scalingGroups[providerID], r.scalingGroupIDErr
}
func (r *stubNodeReplacer) CreateNode(ctx context.Context, scalingGroupID string) (nodeName, providerID string, err error) {
func (r *stubNodeReplacer) CreateNode(_ context.Context, _ string) (nodeName, providerID string, err error) {
r.RLock()
defer r.RUnlock()
return r.createNodeName, r.createProviderID, r.createErr
}
func (r *stubNodeReplacer) DeleteNode(ctx context.Context, providerID string) error {
func (r *stubNodeReplacer) DeleteNode(_ context.Context, _ string) error {
r.RLock()
defer r.RUnlock()
return r.deleteErr
@ -833,11 +833,11 @@ type stubNodeReplacerReader struct {
unimplementedNodeReplacer
}
func (r *stubNodeReplacerReader) GetNodeImage(ctx context.Context, providerID string) (string, error) {
func (r *stubNodeReplacerReader) GetNodeImage(_ context.Context, _ string) (string, error) {
return r.nodeImage, r.nodeImageErr
}
func (r *stubNodeReplacerReader) GetScalingGroupID(ctx context.Context, providerID string) (string, error) {
func (r *stubNodeReplacerReader) GetScalingGroupID(_ context.Context, _ string) (string, error) {
return r.scalingGroupID, r.scalingGroupIDErr
}
@ -853,30 +853,30 @@ type stubNodeReplacerWriter struct {
unimplementedNodeReplacer
}
func (r *stubNodeReplacerWriter) CreateNode(ctx context.Context, scalingGroupID string) (nodeName, providerID string, err error) {
func (r *stubNodeReplacerWriter) CreateNode(_ context.Context, scalingGroupID string) (nodeName, providerID string, err error) {
r.createCalls = append(r.createCalls, scalingGroupID)
return r.createNodeName, r.createProviderID, r.createErr
}
func (r *stubNodeReplacerWriter) DeleteNode(ctx context.Context, providerID string) error {
func (r *stubNodeReplacerWriter) DeleteNode(_ context.Context, providerID string) error {
r.deleteCalls = append(r.deleteCalls, providerID)
return r.deleteErr
}
type unimplementedNodeReplacer struct{}
func (*unimplementedNodeReplacer) GetNodeImage(ctx context.Context, providerID string) (string, error) {
func (*unimplementedNodeReplacer) GetNodeImage(_ context.Context, _ string) (string, error) {
panic("unimplemented")
}
func (*unimplementedNodeReplacer) GetScalingGroupID(ctx context.Context, providerID string) (string, error) {
func (*unimplementedNodeReplacer) GetScalingGroupID(_ context.Context, _ string) (string, error) {
panic("unimplemented")
}
func (*unimplementedNodeReplacer) CreateNode(ctx context.Context, scalingGroupID string) (nodeName, providerID string, err error) {
func (*unimplementedNodeReplacer) CreateNode(_ context.Context, _ string) (nodeName, providerID string, err error) {
panic("unimplemented")
}
func (*unimplementedNodeReplacer) DeleteNode(ctx context.Context, providerID string) error {
func (*unimplementedNodeReplacer) DeleteNode(_ context.Context, _ string) error {
panic("unimplemented")
}

View File

@ -236,13 +236,13 @@ type stubNodeStateGetter struct {
deleteNodeErr error
}
func (g *stubNodeStateGetter) GetNodeState(ctx context.Context, providerID string) (updatev1alpha1.CSPNodeState, error) {
func (g *stubNodeStateGetter) GetNodeState(_ context.Context, _ string) (updatev1alpha1.CSPNodeState, error) {
g.RLock()
defer g.RUnlock()
return g.nodeState, g.nodeStateErr
}
func (g *stubNodeStateGetter) DeleteNode(ctx context.Context, providerID string) error {
func (g *stubNodeStateGetter) DeleteNode(_ context.Context, _ string) error {
g.RLock()
defer g.RUnlock()
return g.deleteNodeErr

View File

@ -22,13 +22,13 @@ func newFakeScalingGroupUpdater() *fakeScalingGroupUpdater {
}
}
func (u *fakeScalingGroupUpdater) GetScalingGroupImage(ctx context.Context, scalingGroupID string) (string, error) {
func (u *fakeScalingGroupUpdater) GetScalingGroupImage(_ context.Context, scalingGroupID string) (string, error) {
u.RLock()
defer u.RUnlock()
return u.scalingGroupImage[scalingGroupID], nil
}
func (u *fakeScalingGroupUpdater) SetScalingGroupImage(ctx context.Context, scalingGroupID, imageURI string) error {
func (u *fakeScalingGroupUpdater) SetScalingGroupImage(_ context.Context, scalingGroupID, imageURI string) error {
u.Lock()
defer u.Unlock()
u.scalingGroupImage[scalingGroupID] = imageURI

View File

@ -25,14 +25,14 @@ type stubScaleSetsAPI struct {
pager *stubVMSSPager
}
func (a *stubScaleSetsAPI) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string,
options *armcompute.VirtualMachineScaleSetsClientGetOptions,
func (a *stubScaleSetsAPI) Get(_ context.Context, _, _ string,
_ *armcompute.VirtualMachineScaleSetsClientGetOptions,
) (armcompute.VirtualMachineScaleSetsClientGetResponse, error) {
return a.scaleSet, a.getErr
}
func (a *stubScaleSetsAPI) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters armcompute.VirtualMachineScaleSetUpdate,
options *armcompute.VirtualMachineScaleSetsClientBeginUpdateOptions,
func (a *stubScaleSetsAPI) BeginUpdate(_ context.Context, _, _ string, _ armcompute.VirtualMachineScaleSetUpdate,
_ *armcompute.VirtualMachineScaleSetsClientBeginUpdateOptions,
) (*runtime.Poller[armcompute.VirtualMachineScaleSetsClientUpdateResponse], error) {
poller, err := runtime.NewPoller(nil, runtime.NewPipeline("", "", runtime.PipelineOptions{}, nil), &runtime.NewPollerOptions[armcompute.VirtualMachineScaleSetsClientUpdateResponse]{
Handler: &stubPoller[armcompute.VirtualMachineScaleSetsClientUpdateResponse]{
@ -46,8 +46,8 @@ func (a *stubScaleSetsAPI) BeginUpdate(ctx context.Context, resourceGroupName st
return poller, a.updateErr
}
func (a *stubScaleSetsAPI) BeginDeleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs,
options *armcompute.VirtualMachineScaleSetsClientBeginDeleteInstancesOptions,
func (a *stubScaleSetsAPI) BeginDeleteInstances(_ context.Context, _, _ string, _ armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs,
_ *armcompute.VirtualMachineScaleSetsClientBeginDeleteInstancesOptions,
) (*runtime.Poller[armcompute.VirtualMachineScaleSetsClientDeleteInstancesResponse], error) {
poller, err := runtime.NewPoller(nil, runtime.NewPipeline("", "", runtime.PipelineOptions{}, nil), &runtime.NewPollerOptions[armcompute.VirtualMachineScaleSetsClientDeleteInstancesResponse]{
Handler: &stubPoller[armcompute.VirtualMachineScaleSetsClientDeleteInstancesResponse]{
@ -61,7 +61,7 @@ func (a *stubScaleSetsAPI) BeginDeleteInstances(ctx context.Context, resourceGro
return poller, a.deleteErr
}
func (a *stubScaleSetsAPI) NewListPager(resourceGroupName string, options *armcompute.VirtualMachineScaleSetsClientListOptions,
func (a *stubScaleSetsAPI) NewListPager(_ string, _ *armcompute.VirtualMachineScaleSetsClientListOptions,
) *runtime.Pager[armcompute.VirtualMachineScaleSetsClientListResponse] {
return runtime.NewPager(runtime.PagingHandler[armcompute.VirtualMachineScaleSetsClientListResponse]{
More: a.pager.moreFunc(),
@ -77,20 +77,20 @@ type stubvirtualMachineScaleSetVMsAPI struct {
pager *stubVMSSVMPager
}
func (a *stubvirtualMachineScaleSetVMsAPI) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string,
options *armcompute.VirtualMachineScaleSetVMsClientGetOptions,
func (a *stubvirtualMachineScaleSetVMsAPI) Get(_ context.Context, _, _, _ string,
_ *armcompute.VirtualMachineScaleSetVMsClientGetOptions,
) (armcompute.VirtualMachineScaleSetVMsClientGetResponse, error) {
return a.scaleSetVM, a.getErr
}
func (a *stubvirtualMachineScaleSetVMsAPI) GetInstanceView(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string,
options *armcompute.VirtualMachineScaleSetVMsClientGetInstanceViewOptions,
func (a *stubvirtualMachineScaleSetVMsAPI) GetInstanceView(_ context.Context, _, _, _ string,
_ *armcompute.VirtualMachineScaleSetVMsClientGetInstanceViewOptions,
) (armcompute.VirtualMachineScaleSetVMsClientGetInstanceViewResponse, error) {
return a.instanceView, a.instanceViewErr
}
func (a *stubvirtualMachineScaleSetVMsAPI) NewListPager(resourceGroupName string, virtualMachineScaleSetName string,
options *armcompute.VirtualMachineScaleSetVMsClientListOptions,
func (a *stubvirtualMachineScaleSetVMsAPI) NewListPager(_, _ string,
_ *armcompute.VirtualMachineScaleSetVMsClientListOptions,
) *runtime.Pager[armcompute.VirtualMachineScaleSetVMsClientListResponse] {
return runtime.NewPager(runtime.PagingHandler[armcompute.VirtualMachineScaleSetVMsClientListResponse]{
More: a.pager.moreFunc(),
@ -112,7 +112,7 @@ func (p *stubPoller[T]) Poll(context.Context) (*http.Response, error) {
return nil, p.pollErr
}
func (p *stubPoller[T]) Result(ctx context.Context, out *T) error {
func (p *stubPoller[T]) Result(_ context.Context, out *T) error {
*out = p.result
return p.resultErr
}

View File

@ -37,7 +37,7 @@ func (c *Client) GetNodeImage(ctx context.Context, providerID string) (string, e
}
// GetScalingGroupID returns the scaling group ID of the node.
func (c *Client) GetScalingGroupID(ctx context.Context, providerID string) (string, error) {
func (c *Client) GetScalingGroupID(_ context.Context, providerID string) (string, error) {
subscriptionID, resourceGroup, scaleSet, _, err := scaleSetInformationFromProviderID(providerID)
if err != nil {
return "", err
@ -146,7 +146,7 @@ func (h *capacityPollingHandler) Poll(ctx context.Context) error {
return nil
}
func (h *capacityPollingHandler) Result(ctx context.Context, out *int64) error {
func (h *capacityPollingHandler) Result(_ context.Context, out *int64) error {
if !h.done {
return fmt.Errorf("failed to scale up")
}

View File

@ -22,37 +22,37 @@ const (
type Client struct{}
// GetNodeImage retrieves the image currently used by a node.
func (c *Client) GetNodeImage(ctx context.Context, providerID string) (string, error) {
func (c *Client) GetNodeImage(_ context.Context, _ string) (string, error) {
panic("not implemented")
}
// GetScalingGroupID retrieves the scaling group that a node is part of.
func (c *Client) GetScalingGroupID(ctx context.Context, providerID string) (string, error) {
func (c *Client) GetScalingGroupID(_ context.Context, _ string) (string, error) {
panic("not implemented")
}
// CreateNode creates a new node inside a specified scaling group at the CSP and returns its future name and provider id.
func (c *Client) CreateNode(ctx context.Context, scalingGroupID string) (nodeName, providerID string, err error) {
func (c *Client) CreateNode(_ context.Context, _ string) (nodeName, _ string, err error) {
panic("not implemented")
}
// DeleteNode starts the termination of the node at the CSP.
func (c *Client) DeleteNode(ctx context.Context, providerID string) error {
func (c *Client) DeleteNode(_ context.Context, _ string) error {
panic("not implemented")
}
// GetNodeState retrieves the state of a pending node from a CSP.
func (c *Client) GetNodeState(ctx context.Context, providerID string) (updatev1alpha1.CSPNodeState, error) {
func (c *Client) GetNodeState(_ context.Context, _ string) (updatev1alpha1.CSPNodeState, error) {
panic("not implemented")
}
// SetScalingGroupImage sets the image to be used by newly created nodes in a scaling group.
func (c *Client) SetScalingGroupImage(ctx context.Context, scalingGroupID, image string) error {
func (c *Client) SetScalingGroupImage(_ context.Context, _, _ string) error {
panic("not implemented")
}
// GetScalingGroupImage retrieves the image currently used by a scaling group.
func (c *Client) GetScalingGroupImage(ctx context.Context, scalingGroupID string) (string, error) {
func (c *Client) GetScalingGroupImage(_ context.Context, _ string) (string, error) {
return "unsupportedCSP", nil
}
@ -81,7 +81,7 @@ func (c *Client) GetAutoscalingGroupName(scalingGroupID string) (string, error)
}
// ListScalingGroups retrieves a list of scaling groups for the cluster.
func (c *Client) ListScalingGroups(ctx context.Context, uid string) (controlPlaneGroupIDs []string, workerGroupIDs []string, err error) {
func (c *Client) ListScalingGroups(_ context.Context, _ string) (controlPlaneGroupIDs []string, workerGroupIDs []string, err error) {
return []string{controlPlanesID}, []string{workersID}, nil
}

View File

@ -25,8 +25,8 @@ func (a stubProjectAPI) Close() error {
return nil
}
func (a stubProjectAPI) Get(ctx context.Context, req *computepb.GetProjectRequest,
opts ...gax.CallOption,
func (a stubProjectAPI) Get(_ context.Context, _ *computepb.GetProjectRequest,
_ ...gax.CallOption,
) (*computepb.Project, error) {
return a.project, a.getErr
}
@ -40,8 +40,8 @@ func (a stubInstanceAPI) Close() error {
return nil
}
func (a stubInstanceAPI) Get(ctx context.Context, req *computepb.GetInstanceRequest,
opts ...gax.CallOption,
func (a stubInstanceAPI) Get(_ context.Context, _ *computepb.GetInstanceRequest,
_ ...gax.CallOption,
) (*computepb.Instance, error) {
return a.instance, a.getErr
}
@ -57,14 +57,14 @@ func (a stubInstanceTemplateAPI) Close() error {
return nil
}
func (a stubInstanceTemplateAPI) Get(ctx context.Context, req *computepb.GetInstanceTemplateRequest,
opts ...gax.CallOption,
func (a stubInstanceTemplateAPI) Get(_ context.Context, _ *computepb.GetInstanceTemplateRequest,
_ ...gax.CallOption,
) (*computepb.InstanceTemplate, error) {
return a.template, a.getErr
}
func (a stubInstanceTemplateAPI) Delete(ctx context.Context, req *computepb.DeleteInstanceTemplateRequest,
opts ...gax.CallOption,
func (a stubInstanceTemplateAPI) Delete(_ context.Context, _ *computepb.DeleteInstanceTemplateRequest,
_ ...gax.CallOption,
) (Operation, error) {
return &stubOperation{
&computepb.Operation{
@ -73,8 +73,8 @@ func (a stubInstanceTemplateAPI) Delete(ctx context.Context, req *computepb.Dele
}, a.deleteErr
}
func (a stubInstanceTemplateAPI) Insert(ctx context.Context, req *computepb.InsertInstanceTemplateRequest,
opts ...gax.CallOption,
func (a stubInstanceTemplateAPI) Insert(_ context.Context, _ *computepb.InsertInstanceTemplateRequest,
_ ...gax.CallOption,
) (Operation, error) {
return &stubOperation{
&computepb.Operation{
@ -96,14 +96,14 @@ func (a stubInstanceGroupManagersAPI) Close() error {
return nil
}
func (a stubInstanceGroupManagersAPI) Get(ctx context.Context, req *computepb.GetInstanceGroupManagerRequest,
opts ...gax.CallOption,
func (a stubInstanceGroupManagersAPI) Get(_ context.Context, _ *computepb.GetInstanceGroupManagerRequest,
_ ...gax.CallOption,
) (*computepb.InstanceGroupManager, error) {
return a.instanceGroupManager, a.getErr
}
func (a stubInstanceGroupManagersAPI) AggregatedList(ctx context.Context, req *computepb.AggregatedListInstanceGroupManagersRequest,
opts ...gax.CallOption,
func (a stubInstanceGroupManagersAPI) AggregatedList(_ context.Context, _ *computepb.AggregatedListInstanceGroupManagersRequest,
_ ...gax.CallOption,
) InstanceGroupManagerScopedListIterator {
return &stubInstanceGroupManagerScopedListIterator{
pairs: []compute.InstanceGroupManagersScopedListPair{
@ -120,8 +120,8 @@ func (a stubInstanceGroupManagersAPI) AggregatedList(ctx context.Context, req *c
}
}
func (a stubInstanceGroupManagersAPI) SetInstanceTemplate(ctx context.Context, req *computepb.SetInstanceTemplateInstanceGroupManagerRequest,
opts ...gax.CallOption,
func (a stubInstanceGroupManagersAPI) SetInstanceTemplate(_ context.Context, _ *computepb.SetInstanceTemplateInstanceGroupManagerRequest,
_ ...gax.CallOption,
) (Operation, error) {
return &stubOperation{
&computepb.Operation{
@ -130,8 +130,8 @@ func (a stubInstanceGroupManagersAPI) SetInstanceTemplate(ctx context.Context, r
}, a.setInstanceTemplateErr
}
func (a stubInstanceGroupManagersAPI) CreateInstances(ctx context.Context, req *computepb.CreateInstancesInstanceGroupManagerRequest,
opts ...gax.CallOption,
func (a stubInstanceGroupManagersAPI) CreateInstances(_ context.Context, _ *computepb.CreateInstancesInstanceGroupManagerRequest,
_ ...gax.CallOption,
) (Operation, error) {
return &stubOperation{
&computepb.Operation{
@ -140,8 +140,8 @@ func (a stubInstanceGroupManagersAPI) CreateInstances(ctx context.Context, req *
}, a.createInstancesErr
}
func (a stubInstanceGroupManagersAPI) DeleteInstances(ctx context.Context, req *computepb.DeleteInstancesInstanceGroupManagerRequest,
opts ...gax.CallOption,
func (a stubInstanceGroupManagersAPI) DeleteInstances(_ context.Context, _ *computepb.DeleteInstancesInstanceGroupManagerRequest,
_ ...gax.CallOption,
) (Operation, error) {
if a.deleteInstancesErr != nil {
return nil, a.deleteInstancesErr
@ -162,8 +162,8 @@ func (a stubDiskAPI) Close() error {
return nil
}
func (a stubDiskAPI) Get(ctx context.Context, req *computepb.GetDiskRequest,
opts ...gax.CallOption,
func (a stubDiskAPI) Get(_ context.Context, _ *computepb.GetDiskRequest,
_ ...gax.CallOption,
) (*computepb.Disk, error) {
return a.disk, a.getErr
}
@ -180,7 +180,7 @@ func (o *stubOperation) Done() bool {
return true
}
func (o *stubOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
func (o *stubOperation) Wait(_ context.Context, _ ...gax.CallOption) error {
return nil
}

View File

@ -73,6 +73,6 @@ type stubRng struct {
result int
}
func (r *stubRng) Intn(n int) int {
func (r *stubRng) Intn(_ int) int {
return r.result
}

Some files were not shown because too many files have changed in this diff Show More