Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return correct error on config read #70

Merged
merged 1 commit into from Sep 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/config/config.go
Expand Up @@ -24,8 +24,9 @@ const (
)

var (
cfg *Config
once sync.Once
cfg *Config
once sync.Once
loadErr error
)

// Config is a in memory representation of the gh configuration files.
Expand Down Expand Up @@ -121,11 +122,10 @@ func (c *Config) Set(keys []string, value string) {
// Read gh configuration files from the local file system and
// return a Config.
var Read = func() (*Config, error) {
var err error
once.Do(func() {
cfg, err = load(generalConfigFile(), hostsConfigFile())
cfg, loadErr = load(generalConfigFile(), hostsConfigFile())
})
return cfg, err
return cfg, loadErr
}

// ReadFromString takes a yaml string and returns a Config.
Expand Down