From 1e80cd8e103e40158d818c796ff8d38206344aef Mon Sep 17 00:00:00 2001 From: Bruno Schaatsbergen Date: Mon, 4 Nov 2024 18:04:08 +0100 Subject: [PATCH] cloud: clarify reason for guard statement Added a comment to explain the rationale behind the guard statement, which prevents potential nil errors during backend initialization and retryLogHook call. Signed-off-by: Bruno Schaatsbergen --- internal/cloud/backend.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/cloud/backend.go b/internal/cloud/backend.go index b2b8625535..4a017eae66 100644 --- a/internal/cloud/backend.go +++ b/internal/cloud/backend.go @@ -605,6 +605,13 @@ func cliConfigToken(hostname svchost.Hostname, services *disco.Disco) (string, e // retryLogHook is invoked each time a request is retried allowing the // backend to log any connection issues to prevent data loss. func (b *Cloud) retryLogHook(attemptNum int, resp *http.Response) { + // FIXME: This guard statement prevents a potential nil error + // due to the way the backend is initialized and the context from which + // this function is called. + // + // In a future refactor, we should ensure that views are natively supported + // in backends and allow for calling a View directly within the + // backend.Configure method. if b.CLI != nil { b.View.RetryLog(attemptNum, resp) }