Skip to content

fix(go): update NewCfg to return error for better error handling - #312

Merged
manusa merged 1 commit into
mainfrom
fix/config-err
Nov 18, 2025
Merged

fix(go): update NewCfg to return error for better error handling#312
manusa merged 1 commit into
mainfrom
fix/config-err

Conversation

@manusa

Copy link
Copy Markdown
Owner

No description provided.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves error handling in the Helm package by updating the NewCfg function to return an error instead of using panic-based error handling. This change makes errors more explicit and easier to handle gracefully.

Key Changes:

  • Modified NewCfg to return (*action.Configuration, error) instead of just *action.Configuration
  • Replaced panic calls with proper error returns using fmt.Errorf with error wrapping
  • Updated all call sites across 9 files to handle the returned error
  • Added comprehensive test coverage for error scenarios

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
native/internal/helm/helm.goUpdated NewCfg function signature to return error; replaced panics with proper error returns
native/internal/helm/upgrade.goAdded error handling for NewCfg call
native/internal/helm/uninstall.goAdded error handling for NewCfg call
native/internal/helm/test.goAdded error handling for NewCfg call
native/internal/helm/show.goAdded error handling for NewCfg call
native/internal/helm/registry.goAdded error handling for NewCfg calls in both login and logout functions
native/internal/helm/push.goAdded error handling for NewCfg call
native/internal/helm/list.goAdded error handling for NewCfg call
native/internal/helm/install.goAdded error handling for NewCfg call
native/internal/helm/plugins_test.goUpdated 5 test cases to handle NewCfg error return
native/internal/helm/helm_test.goUpdated existing test and added new tests for invalid kubeconfig scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@manusa
manusa merged commit 3add14b into mainNov 18, 2025
9 checks passed
@manusa
manusa deleted the fix/config-err branch November 18, 2025 07:57
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@manusa