mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Merge pull request #1 from justenstall/stdlib-errors-2-lint-issues
Fix lint issues
This commit is contained in:
commit
6c3fc1d755
13 changed files with 23 additions and 23 deletions
|
|
@ -247,7 +247,7 @@ func (i *Install) RunWithContext(ctx context.Context, chrt *chart.Chart, vals ma
|
|||
// HideSecret must be used with dry run. Otherwise, return an error.
|
||||
if !i.isDryRun() && i.HideSecret {
|
||||
slog.Error("hiding Kubernetes secrets requires a dry-run mode")
|
||||
return nil, errors.New("Hiding Kubernetes secrets requires a dry-run mode")
|
||||
return nil, errors.New("hiding Kubernetes secrets requires a dry-run mode")
|
||||
}
|
||||
|
||||
if err := i.availableName(); err != nil {
|
||||
|
|
@ -365,7 +365,7 @@ func (i *Install) RunWithContext(ctx context.Context, chrt *chart.Chart, vals ma
|
|||
toBeAdopted, err = existingResourceConflict(resources, rel.Name, rel.Namespace)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to continue with install: %w", err)
|
||||
return nil, fmt.Errorf("unable to continue with install: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ func (u *Upgrade) prepareUpgrade(name string, chart *chart.Chart, vals map[strin
|
|||
|
||||
// HideSecret must be used with dry run. Otherwise, return an error.
|
||||
if !u.isDryRun() && u.HideSecret {
|
||||
return nil, nil, errors.New("Hiding Kubernetes secrets requires a dry-run mode")
|
||||
return nil, nil, errors.New("hiding Kubernetes secrets requires a dry-run mode")
|
||||
}
|
||||
|
||||
// finds the last non-deleted release with the given name
|
||||
|
|
@ -353,7 +353,7 @@ func (u *Upgrade) performUpgrade(ctx context.Context, originalRelease, upgradedR
|
|||
toBeUpdated, err = existingResourceConflict(toBeCreated, upgradedRelease.Name, upgradedRelease.Namespace)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to continue with update: %w", err)
|
||||
return nil, fmt.Errorf("unable to continue with update: %w", err)
|
||||
}
|
||||
|
||||
toBeUpdated.Visit(func(r *resource.Info, err error) error {
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ func LoadFiles(files []*BufferedFile) (*chart.Chart, error) {
|
|||
}
|
||||
|
||||
if c.Metadata == nil {
|
||||
return c, errors.New("Chart.yaml file is missing")
|
||||
return c, errors.New("Chart.yaml file is missing") //nolint:staticcheck
|
||||
}
|
||||
|
||||
if err := c.Validate(); err != nil {
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ func writeTarContents(out *tar.Writer, c *chart.Chart, prefix string) error {
|
|||
// Save values.schema.json if it exists
|
||||
if c.Schema != nil {
|
||||
if !json.Valid(c.Schema) {
|
||||
return errors.New("Invalid JSON in " + SchemafileName)
|
||||
return errors.New("invalid JSON in " + SchemafileName)
|
||||
}
|
||||
if err := writeToTar(out, filepath.Join(base, SchemafileName), c.Schema); err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ func runInstall(args []string, client *action.Install, valueOpts *values.Options
|
|||
return nil, fmt.Errorf("failed reloading chart after repo update: %w", err)
|
||||
}
|
||||
} else {
|
||||
return nil, fmt.Errorf("An error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies: %w", err)
|
||||
return nil, fmt.Errorf("an error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -358,7 +358,7 @@ func validateDryRunOptionFlag(dryRunOptionFlagValue string) error {
|
|||
}
|
||||
}
|
||||
if !isAllowed {
|
||||
return errors.New("Invalid dry-run flag. Flag must one of the following: false, true, none, client, server")
|
||||
return errors.New("invalid dry-run flag. Flag must one of the following: false, true, none, client, server")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,12 +69,12 @@ func (o *pluginUninstallOptions) run(out io.Writer) error {
|
|||
for _, name := range o.names {
|
||||
if found := findPlugin(plugins, name); found != nil {
|
||||
if err := uninstallPlugin(found); err != nil {
|
||||
errorPlugins = append(errorPlugins, fmt.Errorf("Failed to uninstall plugin %s, got error (%v)", name, err))
|
||||
errorPlugins = append(errorPlugins, fmt.Errorf("failed to uninstall plugin %s, got error (%v)", name, err))
|
||||
} else {
|
||||
fmt.Fprintf(out, "Uninstalled plugin: %s\n", name)
|
||||
}
|
||||
} else {
|
||||
errorPlugins = append(errorPlugins, fmt.Errorf("Plugin: %s not found", name))
|
||||
errorPlugins = append(errorPlugins, fmt.Errorf("plugin: %s not found", name))
|
||||
}
|
||||
}
|
||||
if len(errorPlugins) > 0 {
|
||||
|
|
|
|||
|
|
@ -72,12 +72,12 @@ func (o *pluginUpdateOptions) run(out io.Writer) error {
|
|||
for _, name := range o.names {
|
||||
if found := findPlugin(plugins, name); found != nil {
|
||||
if err := updatePlugin(found); err != nil {
|
||||
errorPlugins = append(errorPlugins, fmt.Errorf("Failed to update plugin %s, got error (%v)", name, err))
|
||||
errorPlugins = append(errorPlugins, fmt.Errorf("failed to update plugin %s, got error (%v)", name, err))
|
||||
} else {
|
||||
fmt.Fprintf(out, "Updated plugin: %s\n", name)
|
||||
}
|
||||
} else {
|
||||
errorPlugins = append(errorPlugins, fmt.Errorf("Plugin: %s not found", name))
|
||||
errorPlugins = append(errorPlugins, fmt.Errorf("plugin: %s not found", name))
|
||||
}
|
||||
}
|
||||
if len(errorPlugins) > 0 {
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
|||
}
|
||||
if req := ch.Metadata.Dependencies; req != nil {
|
||||
if err := action.CheckDependencies(ch, req); err != nil {
|
||||
err = fmt.Errorf("An error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies: %w", err)
|
||||
err = fmt.Errorf("an error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies: %w", err)
|
||||
if client.DependencyUpdate {
|
||||
man := &downloader.Manager{
|
||||
Out: out,
|
||||
|
|
|
|||
|
|
@ -64,11 +64,11 @@ func (g *HTTPGetter) get(href string) (*bytes.Buffer, error) {
|
|||
// with the basic auth is the one being fetched.
|
||||
u1, err := url.Parse(g.opts.url)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to parse getter URL: %w", err)
|
||||
return nil, fmt.Errorf("unable to parse getter URL: %w", err)
|
||||
}
|
||||
u2, err := url.Parse(href)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to parse URL getting from: %w", err)
|
||||
return nil, fmt.Errorf("unable to parse URL getting from: %w", err)
|
||||
}
|
||||
|
||||
// Host on URL (returned from url.Parse) contains the port if present.
|
||||
|
|
|
|||
|
|
@ -184,13 +184,13 @@ func (c *Client) IsReachable() error {
|
|||
if err == genericclioptions.ErrEmptyConfig {
|
||||
// re-replace kubernetes ErrEmptyConfig error with a friendly error
|
||||
// moar workarounds for Kubernetes API breaking.
|
||||
return errors.New("Kubernetes cluster unreachable")
|
||||
return errors.New("kubernetes cluster unreachable")
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("Kubernetes cluster unreachable: %w", err)
|
||||
return fmt.Errorf("kubernetes cluster unreachable: %w", err)
|
||||
}
|
||||
if _, err := client.Discovery().ServerVersion(); err != nil {
|
||||
return fmt.Errorf("Kubernetes cluster unreachable: %w", err)
|
||||
return fmt.Errorf("kubernetes cluster unreachable: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -742,12 +742,12 @@ func (c *Client) OutputContainerLogsForPodList(podList *v1.PodList, namespace st
|
|||
func copyRequestStreamToWriter(request *rest.Request, podName, containerName string, writer io.Writer) error {
|
||||
readCloser, err := request.Stream(context.Background())
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to stream pod logs for pod: %s, container: %s", podName, containerName)
|
||||
return fmt.Errorf("failed to stream pod logs for pod: %s, container: %s", podName, containerName)
|
||||
}
|
||||
defer readCloser.Close()
|
||||
_, err = io.Copy(writer, readCloser)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to copy IO from logs for pod: %s, container: %s", podName, containerName)
|
||||
return fmt.Errorf("failed to copy IO from logs for pod: %s, container: %s", podName, containerName)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ func validateListAnnotations(yamlStruct *K8sYamlStruct, manifest string) error {
|
|||
|
||||
for _, i := range m.Items {
|
||||
if _, ok := i.Metadata.Annotations["helm.sh/resource-policy"]; ok {
|
||||
return errors.New("Annotation 'helm.sh/resource-policy' within List objects are ignored")
|
||||
return errors.New("annotation 'helm.sh/resource-policy' within List objects are ignored")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -881,7 +881,7 @@ func (c *Client) ValidateReference(ref, version string, u *url.URL) (*url.URL, e
|
|||
return nil, err
|
||||
}
|
||||
if len(tags) == 0 {
|
||||
return nil, fmt.Errorf("Unable to locate any tags in provided repository: %s", ref)
|
||||
return nil, fmt.Errorf("unable to locate any tags in provided repository: %s", ref)
|
||||
}
|
||||
|
||||
// Determine if version provided
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ func GetTagMatchingVersionOrConstraint(tags []string, versionString string) (str
|
|||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("Could not locate a version matching provided version string %s", versionString)
|
||||
return "", fmt.Errorf("could not locate a version matching provided version string %s", versionString)
|
||||
}
|
||||
|
||||
// extractChartMeta is used to extract a chart metadata from a byte array
|
||||
|
|
|
|||
Loading…
Reference in a new issue