Skip to content

refactor(config): remove unused ConfigPath package variable#445

Open
hazelmayank wants to merge 1 commit into
microcks:masterfrom
hazelmayank:refactor/remove-dead-configpath
Open

refactor(config): remove unused ConfigPath package variable#445
hazelmayank wants to merge 1 commit into
microcks:masterfrom
hazelmayank:refactor/remove-dead-configpath

Conversation

@hazelmayank
Copy link
Copy Markdown
Contributor

Summary

Removes the unused package-level ConfigPath variable from pkg/config/config.go
along with the path/filepath import it was the sole user of.

Fixes #444 .

Background

pkg/config/config.go declared:

var (
    ...
    ConfigPath = filepath.Join(os.Getenv("HOME"), ".microcks-cli", "config.yaml")
)

This variable is never read anywhere in the repo. A grep for config.ConfigPath\b
returns no matches — every apparent hit resolves to the unrelated ConfigPath
field on the ClientOptions struct (opts.ConfigPath / globalClientOpts.ConfigPath).

The actual default config path the CLI uses comes from DefaultLocalConfigPath()
in pkg/config/localconfig.go, which uses os.UserHomeDir() — the
cross-platform-safe API.

If anything ever did start reading config.ConfigPath, it would silently break
on Windows: os.Getenv("HOME") returns "" on a vanilla Windows install
(Windows uses USERPROFILE), producing a broken relative path like
\.microcks-cli\config.yaml.

Changes

pkg/config/config.go:

  • Removed the unused ConfigPath variable.
  • Removed the path/filepath import (only used by the removed variable).

Test plan

  • go build . passes.
  • microcks --help and microcks context still resolve the config path
    correctly (via DefaultLocalConfigPath() in localconfig.go).
  • CI passes on all platforms.

Signed-off-by: hazelmayank <mayankjeefinal@gmail.com>
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.

Remove dead ConfigPath variable in pkg/config/config.go (also uses HOME which is empty on Windows)

1 participant