Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit e40a1ce

Browse files
committed
Ask to restart Docker Desktop when the config file can't be read
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
1 parent 4f91a19 commit e40a1ce

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

config/config.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,13 @@ func ReadConfigFile() (Config, error) {
3939
var conf Config
4040
path := filepath.Join(cliConfig.Dir(), "scan", "config.json")
4141
buf, err := ioutil.ReadFile(path)
42-
if os.IsNotExist(err) {
43-
return conf, nil
44-
}
4542
if err != nil {
46-
return conf, errors.Wrap(err, "failed to read docker scan configuration file")
43+
_ = os.Remove(path)
44+
return conf, errors.Wrap(err, "failed to read docker scan configuration file. Please restart Docker Desktop")
4745
}
4846
if err := json.Unmarshal(buf, &conf); err != nil {
49-
return conf, errors.Wrapf(err, "invalid docker scan configuration file %s", path)
47+
_ = os.Remove(path)
48+
return conf, errors.Wrapf(err, "invalid docker scan configuration file %s. Please restart Docker Desktop", path)
5049
}
5150
return conf, nil
5251
}

0 commit comments

Comments
 (0)