diff --git a/internal/deployer/kubectl.go b/internal/deployer/kubectl.go index 9fe7c98..8acf6ef 100644 --- a/internal/deployer/kubectl.go +++ b/internal/deployer/kubectl.go @@ -7,9 +7,6 @@ import ( ) // runKubectl is a thin wrapper around k8s.RunKubectl that injects the deployer's logger. -// -// TODO(ROX-34499): perhaps this should not return a pointer so that the lack of nil checks elsewhere -// is robust? -func (d *Deployer) runKubectl(ctx context.Context, opts k8s.KubectlOptions) (*k8s.KubectlResult, error) { +func (d *Deployer) runKubectl(ctx context.Context, opts k8s.KubectlOptions) (k8s.KubectlResult, error) { return k8s.RunKubectl(ctx, d.logger, opts) } diff --git a/internal/k8s/kubectl.go b/internal/k8s/kubectl.go index 67e8f9c..b0695f5 100644 --- a/internal/k8s/kubectl.go +++ b/internal/k8s/kubectl.go @@ -28,7 +28,7 @@ type KubectlResult struct { } // RunKubectl executes a kubectl command with automatic retries on transient errors -func RunKubectl(ctx context.Context, log *logger.Logger, opts KubectlOptions) (*KubectlResult, error) { +func RunKubectl(ctx context.Context, log *logger.Logger, opts KubectlOptions) (KubectlResult, error) { if opts.MaxAttempts <= 0 { opts.MaxAttempts = 3 } @@ -88,14 +88,14 @@ func RunKubectl(ctx context.Context, log *logger.Logger, opts KubectlOptions) (* lastErr = err if err == nil { - return &KubectlResult{ + return KubectlResult{ Stdout: stdout.String(), Stderr: lastStderr, }, nil } if opts.IgnoreErrors { - return &KubectlResult{ + return KubectlResult{ Stdout: stdout.String(), Stderr: lastStderr, }, nil @@ -111,7 +111,7 @@ func RunKubectl(ctx context.Context, log *logger.Logger, opts KubectlOptions) (* } if !isRetryable || attempt == opts.MaxAttempts { - return &KubectlResult{ + return KubectlResult{ Stdout: stdout.String(), Stderr: lastStderr, }, fmt.Errorf("kubectl command failed: %w", err) @@ -122,7 +122,7 @@ func RunKubectl(ctx context.Context, log *logger.Logger, opts KubectlOptions) (* } } - return &KubectlResult{ + return KubectlResult{ Stdout: "", Stderr: lastStderr, }, fmt.Errorf("kubectl command failed after %d attempts: %w", opts.MaxAttempts, lastErr)