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

@ -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
}

View file

@ -77,7 +77,7 @@ type stubClient struct {
client.Client
}
func (c *stubClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error {
func (c *stubClient) List(_ context.Context, list client.ObjectList, _ ...client.ListOption) error {
list.(*corev1.NodeList).Items = c.nodes
return c.listErr
}

View file

@ -347,7 +347,7 @@ type fakeK8sClient struct {
client.Client
}
func (s *fakeK8sClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error {
func (s *fakeK8sClient) Create(_ context.Context, obj client.Object, _ ...client.CreateOption) error {
for _, o := range s.createdObjects {
if obj.GetName() == o.GetName() {
return k8sErrors.NewAlreadyExists(schema.GroupResource{}, obj.GetName())
@ -358,7 +358,7 @@ func (s *fakeK8sClient) Create(ctx context.Context, obj client.Object, opts ...c
return s.createErr
}
func (s *fakeK8sClient) Get(ctx context.Context, key types.NamespacedName, obj client.Object, opts ...client.GetOption) error {
func (s *fakeK8sClient) Get(_ context.Context, key types.NamespacedName, obj client.Object, _ ...client.GetOption) error {
if ObjNodeVersion, ok := obj.(*updatev1alpha1.NodeVersion); ok {
for _, o := range s.createdObjects {
if createdNodeVersion, ok := o.(*updatev1alpha1.NodeVersion); ok && createdNodeVersion != nil {
@ -375,7 +375,7 @@ func (s *fakeK8sClient) Get(ctx context.Context, key types.NamespacedName, obj c
return s.getErr
}
func (s *fakeK8sClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error {
func (s *fakeK8sClient) Update(_ context.Context, obj client.Object, _ ...client.UpdateOption) error {
if updatedObjectNodeVersion, ok := obj.(*updatev1alpha1.NodeVersion); ok {
for i, o := range s.createdObjects {
if createdObjectNodeVersion, ok := o.(*updatev1alpha1.NodeVersion); ok && createdObjectNodeVersion != nil {
@ -389,7 +389,7 @@ func (s *fakeK8sClient) Update(ctx context.Context, obj client.Object, opts ...c
return s.updateErr
}
func (s *fakeK8sClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error {
func (s *fakeK8sClient) List(_ context.Context, list client.ObjectList, _ ...client.ListOption) error {
if configMapList, ok := list.(*corev1.ConfigMapList); ok {
configMapList.Items = append(configMapList.Items, s.listConfigMaps...)
}
@ -425,7 +425,7 @@ func newScalingGroupGetter(items []scalingGroupStoreItem, imageErr, nameErr, lis
}
}
func (g *stubScalingGroupGetter) GetScalingGroupImage(ctx context.Context, scalingGroupID string) (string, error) {
func (g *stubScalingGroupGetter) GetScalingGroupImage(_ context.Context, scalingGroupID string) (string, error) {
return g.store[scalingGroupID].image, g.imageErr
}
@ -437,7 +437,7 @@ func (g *stubScalingGroupGetter) GetAutoscalingGroupName(scalingGroupID string)
return g.store[scalingGroupID].name, g.nameErr
}
func (g *stubScalingGroupGetter) ListScalingGroups(ctx context.Context, uid string) (controlPlaneGroupIDs []string, workerGroupIDs []string, err error) {
func (g *stubScalingGroupGetter) ListScalingGroups(_ context.Context, _ string) (controlPlaneGroupIDs []string, workerGroupIDs []string, err error) {
for _, item := range g.store {
if item.isControlPlane {
controlPlaneGroupIDs = append(controlPlaneGroupIDs, item.groupID)

View file

@ -172,7 +172,7 @@ type stubK8sClient struct {
client.Client
}
func (c *stubK8sClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error {
func (c *stubK8sClient) List(_ context.Context, list client.ObjectList, _ ...client.ListOption) error {
list.(*corev1.NodeList).Items = c.nodes
return c.listErr
}
@ -185,19 +185,19 @@ type stubEtcdClient struct {
closeErr error
}
func (c *stubEtcdClient) MemberList(ctx context.Context) (*clientv3.MemberListResponse, error) {
func (c *stubEtcdClient) MemberList(_ context.Context) (*clientv3.MemberListResponse, error) {
return &clientv3.MemberListResponse{
Members: c.members,
}, c.listErr
}
func (c *stubEtcdClient) MemberRemove(ctx context.Context, memberID uint64) (*clientv3.MemberRemoveResponse, error) {
func (c *stubEtcdClient) MemberRemove(_ context.Context, _ uint64) (*clientv3.MemberRemoveResponse, error) {
return &clientv3.MemberRemoveResponse{
Members: c.members,
}, c.removeErr
}
func (c *stubEtcdClient) Sync(ctx context.Context) error {
func (c *stubEtcdClient) Sync(_ context.Context) error {
return c.syncErr
}

View file

@ -170,7 +170,7 @@ type stubPoller[T any] struct {
resultErr error
}
func (s *stubPoller[T]) Poll(ctx context.Context) error {
func (s *stubPoller[T]) Poll(_ context.Context) error {
return s.pollErr
}
@ -178,7 +178,7 @@ func (s *stubPoller[T]) Done() bool {
return s.done
}
func (s *stubPoller[T]) Result(ctx context.Context, out *T) error {
func (s *stubPoller[T]) Result(_ context.Context, out *T) error {
*out = *s.result
return s.resultErr
}
@ -197,7 +197,7 @@ type fakePoller[T any] struct {
pollC chan error
}
func (s *fakePoller[T]) Poll(ctx context.Context) error {
func (s *fakePoller[T]) Poll(_ context.Context) error {
return <-s.pollC
}
@ -205,7 +205,7 @@ func (s *fakePoller[T]) Done() bool {
return <-s.doneC
}
func (s *fakePoller[T]) Result(ctx context.Context, out *T) error {
func (s *fakePoller[T]) Result(_ context.Context, out *T) error {
*out = *s.result
return s.resultErr
}