Skip to content

Commit

Permalink
Fix staticcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
hjkatz authored and masonj5n committed Jan 23, 2025
1 parent 163c49f commit ae9d29f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions internal/controller/bindings/boundendpoint_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/go-logr/logr"
"github.com/ngrok/ngrok-api-go/v6"
"github.com/ngrok/ngrok-api-go/v7"
bindingsv1alpha1 "github.com/ngrok/ngrok-operator/api/bindings/v1alpha1"
"github.com/ngrok/ngrok-operator/internal/controller"
"github.com/ngrok/ngrok-operator/internal/ngrokapi"
Expand Down Expand Up @@ -612,5 +612,16 @@ func (r *BoundEndpointReconciler) tryToBindEndpoint(ctx context.Context, boundEn

// set status
setEndpointsStatus(boundEndpoint, desired)
return ngrokErr

// Why do we check for nil here and return nil explicitly instead of just `return ngrokErr`?
// Because *ngrok.Error meets the interface of error means that error is actually (T=*ngrok.Error, V=nil)
// so outer function signature is (error) and not (*ngrok.Error)
// and an interface _pointing_ to nil is != to nil itself
// therefore *ngrok.Error.(error) is _always_ != nil
//
// See: https://go.dev/doc/faq#nil_error
if ngrokErr != nil {
return ngrokErr
}
return nil

Check warning on line 626 in internal/controller/bindings/boundendpoint_controller.go

View check run for this annotation

Codecov / codecov/patch

internal/controller/bindings/boundendpoint_controller.go#L615-L626

Added lines #L615 - L626 were not covered by tests
}

0 comments on commit ae9d29f

Please sign in to comment.