Skip to content

Commit 3ab7192

Browse files
committed
apply golangcilint
1 parent de5461d commit 3ab7192

File tree

2 files changed

+7
-29
lines changed

2 files changed

+7
-29
lines changed

cloud/scope/machine.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func (m *MachineScope) GetBiosUUID() *string {
147147
if err != nil {
148148
return nil
149149
}
150-
return pointer.StringPtr(parsed.ID())
150+
return pointer.String(parsed.ID())
151151
}
152152

153153
func (m *MachineScope) GetProviderID() string {
@@ -194,7 +194,7 @@ func (m *MachineScope) SetProviderID(uuid string) error {
194194
if err != nil {
195195
return err
196196
}
197-
m.ProxmoxMachine.Spec.ProviderID = pointer.StringPtr(providerid.String())
197+
m.ProxmoxMachine.Spec.ProviderID = pointer.String(providerid.String())
198198
return nil
199199
}
200200

@@ -207,7 +207,7 @@ func (m *MachineScope) SetReady() {
207207
}
208208

209209
func (m *MachineScope) SetFailureMessage(v error) {
210-
m.ProxmoxMachine.Status.FailureMessage = pointer.StringPtr(v.Error())
210+
m.ProxmoxMachine.Status.FailureMessage = pointer.String(v.Error())
211211
}
212212

213213
func (m *MachineScope) SetFailureReason(v capierrors.MachineStatusError) {

cloud/services/compute/instance/reconcile.go

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"regexp"
7-
"strconv"
87
"strings"
98

109
"github.com/pkg/errors"
@@ -37,7 +36,9 @@ func (s *Service) Reconcile(ctx context.Context) error {
3736
}
3837

3938
log.Info(fmt.Sprintf("Reconciled instance: bios-uuid=%s", *uuid))
40-
s.scope.SetProviderID(*uuid)
39+
if err := s.scope.SetProviderID(*uuid); err != nil {
40+
return err
41+
}
4142
s.scope.SetInstanceStatus(infrav1.InstanceStatus(instance.Status))
4243
// s.scope.SetAddresses()
4344
return nil
@@ -127,7 +128,7 @@ func getBiosUUID(vm *vm.VirtualMachine) (*string, error) {
127128
if err != nil {
128129
return nil, err
129130
}
130-
return pointer.StringPtr(uuid), nil
131+
return pointer.String(uuid), nil
131132
}
132133

133134
func convertSMBiosToUUID(smbios string) (string, error) {
@@ -140,29 +141,6 @@ func convertSMBiosToUUID(smbios string) (string, error) {
140141
return strings.Split(match, "=")[1], nil
141142
}
142143

143-
// will be abolished
144-
func (s *Service) getInstanceFromInstanceID(instanceID string) (*vm.VirtualMachine, error) {
145-
vmid, err := strconv.Atoi(instanceID)
146-
if err != nil {
147-
return nil, err
148-
}
149-
nodes, err := s.client.Nodes()
150-
if err != nil {
151-
return nil, err
152-
}
153-
if len(nodes) == 0 {
154-
return nil, errors.New("proxmox nodes not found")
155-
}
156-
for _, node := range nodes {
157-
vm, err := node.VirtualMachine(vmid)
158-
if err != nil {
159-
continue
160-
}
161-
return vm, nil
162-
}
163-
return nil, api.ErrNotFound
164-
}
165-
166144
func (s *Service) getInstanceFromBiosUUID(uuid string) (*vm.VirtualMachine, error) {
167145
nodes, err := s.client.Nodes()
168146
if err != nil {

0 commit comments

Comments
 (0)