Skip to content

Dead code: unreachable fallback path in RepoRelease.downloadChart #155

Description

@zacharyblasczyk

Description

In pkg/wandb/spec/charts/repo.go:278-281, the fallback destination path can never trigger:

dest := filepath.Join(os.Getenv("HELM_DATA_HOME"), "charts")
if dest == "" {
    dest = "./charts"
}

When HELM_DATA_HOME is empty, filepath.Join("", "charts") returns "charts" (not ""), so the dest == "" guard is never true and the "./charts" fallback is dead code.

Functionally benign since "charts" and "./charts" resolve to the same path, but the dead branch is misleading.

Suggested fix

Either remove the dead branch or check the env var directly:

dest := os.Getenv("HELM_DATA_HOME")
if dest == "" {
    dest = "./charts"
} else {
    dest = filepath.Join(dest, "charts")
}

Found during review of #147.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions