diff --git a/command/link.go b/command/link.go index 5c8fa26..4d3d5c8 100644 --- a/command/link.go +++ b/command/link.go @@ -49,8 +49,11 @@ func LinkLatest() error { target := GetLink(sourceVersion) _, err := LsBestMatchWithVersionSlice(vs, sourceVersion) if err != nil { - log.Info(sourceVersion + " -/> " + target) - if err := os.Remove(filepath.Join(cfg.Dir(), "jdk", sourceVersion)); !os.IsNotExist(err) { + err := os.Remove(filepath.Join(cfg.Dir(), "jdk", sourceVersion)) + if err == nil { + log.Info(sourceVersion + " -/> " + target) + } + if !os.IsNotExist(err) { return err } } else {