Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit f098caa

Browse files
committed
Use constant error message to avoid dynamic error linting error
Signed-off-by: Chris Privitere <[email protected]>
1 parent 77978c7 commit f098caa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

controllers/packetmachine_controller.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ const (
5252
force = true
5353
)
5454

55-
var ErrMissingDevice = errors.New("machine does not exist")
55+
var (
56+
ErrMissingDevice = errors.New("machine does not exist")
57+
ErrFacilityMetroMatch = errors.New("instance facility does not match machine facility")
58+
)
5659

5760
// PacketMachineReconciler reconciles a PacketMachine object
5861
type PacketMachineReconciler struct {
@@ -415,7 +418,7 @@ func (r *PacketMachineReconciler) reconcile(ctx context.Context, machineScope *s
415418
// If Metro or Facility has changed in the spec, verify that the facility's metro is compatible with the requested spec change.
416419

417420
if machineScope.PacketMachine.Spec.Facility != "" && machineScope.PacketMachine.Spec.Facility != dev.Facility.Code {
418-
return ctrl.Result{}, fmt.Errorf("instance facility does not match machine facility %s: %q != %q", machineScope.Name(), machineScope.PacketMachine.Spec.Facility, dev.Facility.Code)
421+
return ctrl.Result{}, fmt.Errorf("%w: %s != %s", ErrFacilityMetroMatch, machineScope.PacketMachine.Spec.Facility, dev.Facility.Code)
419422
}
420423

421424
if machineScope.PacketMachine.Spec.Metro != "" && machineScope.PacketMachine.Spec.Metro != dev.Metro.Code {

0 commit comments

Comments
 (0)