Skip to content

Comments

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

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

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

Conversation

@manusa
Copy link
Owner

@manusa manusa commented Nov 17, 2025

No description provided.

Copy link

Copilot AI left a comment

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
File Description
native/internal/helm/helm.go Updated NewCfg function signature to return error; replaced panics with proper error returns
native/internal/helm/upgrade.go Added error handling for NewCfg call
native/internal/helm/uninstall.go Added error handling for NewCfg call
native/internal/helm/test.go Added error handling for NewCfg call
native/internal/helm/show.go Added error handling for NewCfg call
native/internal/helm/registry.go Added error handling for NewCfg calls in both login and logout functions
native/internal/helm/push.go Added error handling for NewCfg call
native/internal/helm/list.go Added error handling for NewCfg call
native/internal/helm/install.go Added error handling for NewCfg call
native/internal/helm/plugins_test.go Updated 5 test cases to handle NewCfg error return
native/internal/helm/helm_test.go Updated 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 main Nov 18, 2025
9 checks passed
@manusa manusa deleted the fix/config-err branch November 18, 2025 07:57
Sign up for free to 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.

1 participant