Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions plugins/credentialhelper/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@
// https://github.com/docker/cli/blob/master/cli/config/config.go#L24
const envOverrideConfigDir = "DOCKER_CONFIG"

func getConfigPath() string {
func getConfigPath() (string,error) {
configDir := os.Getenv(envOverrideConfigDir)
if configDir != "" {
return configDir
return configDir,nil
}

// continue with normal config resolution
Expand All @@ -156,10 +156,14 @@
}
}

if home == "" {
return "", fmt.Errorf("cannot determine home directory")
}

// there might be a case here where a system does not report a home
// directory based on the above steps taken from the CLI.
// We will error when we try to open a non-exiting file.
return path.Join(home, ".docker", "config.json")

Check failure on line 166 in plugins/credentialhelper/store.go

View workflow job for this annotation

GitHub Actions / Unit Tests

not enough return values
}

type Options func(*credentialHelperStore)
Expand All @@ -185,7 +189,7 @@
}

if c.ProgramFunc == nil {
configPath := getConfigPath()

Check failure on line 192 in plugins/credentialhelper/store.go

View workflow job for this annotation

GitHub Actions / Unit Tests

assignment mismatch: 1 variable but getConfigPath returns 2 values
f, err := os.Open(configPath)
if err != nil {
return nil, err
Expand Down
Loading