Cleaned up per go vet
Note, this change caused a public API change. msg.Error became
msg.Err. Go vet expects Error functions to not have formatting. If
they do it expects Errorf. This is even for non-standard library
functions. Changing to Err because it aligns with Info and Warn
which are both short hand names.
diff --git a/action/ensure.go b/action/ensure.go
index 2a14d82..0fa529a 100644
--- a/action/ensure.go
+++ b/action/ensure.go
@@ -36,7 +36,7 @@
return conf
}
-// EnsureCacheDir ensures the existance of the cache directory
+// EnsureCacheDir ensures the existence of the cache directory
func EnsureCacheDir() {
msg.Warn("ensure.go: ensureCacheDir is not implemented.")
}
@@ -53,7 +53,7 @@
// This works with 1.5 and >=1.6.
cmd = exec.Command("go", "env", "GO15VENDOREXPERIMENT")
if out, err := cmd.CombinedOutput(); err != nil {
- msg.Error("Error looking for $GOVENDOREXPERIMENT: %s.\n", err)
+ msg.Err("Error looking for $GOVENDOREXPERIMENT: %s.\n", err)
os.Exit(1)
} else if strings.TrimSpace(string(out)) != "1" {
msg.Warn("To use Glide, you must set GO15VENDOREXPERIMENT=1\n")
@@ -105,7 +105,7 @@
return gp
}
- msg.Error("Could not find any of %s/src.\n", strings.Join(gps, "/src, "))
+ msg.Err("Could not find any of %s/src.\n", strings.Join(gps, "/src, "))
msg.Info("As of Glide 0.5/Go 1.5, this is required.\n")
msg.Die("Wihtout src, cannot continue.")
return ""
diff --git a/action/get.go b/action/get.go
index 7ad986f..22e0652 100644
--- a/action/get.go
+++ b/action/get.go
@@ -56,7 +56,7 @@
// Set Reference
if err := repo.SetReference(confcopy); err != nil {
- msg.Error("Failed to set references: %s", err)
+ msg.Err("Failed to set references: %s", err)
}
// VendoredCleanup
diff --git a/action/install.go b/action/install.go
index 6ba06e5..8608dc8 100644
--- a/action/install.go
+++ b/action/install.go
@@ -49,7 +49,7 @@
// Set reference
if err := repo.SetReference(newConf); err != nil {
- msg.Error("Failed to set references: %s (Skip to cleanup)", err)
+ msg.Err("Failed to set references: %s (Skip to cleanup)", err)
}
// VendoredCleanup. This should ONLY be run if UpdateVendored was specified.
diff --git a/action/no_vendor.go b/action/no_vendor.go
index 95a0126..961d992 100644
--- a/action/no_vendor.go
+++ b/action/no_vendor.go
@@ -17,7 +17,7 @@
// This is responsible for printing the results of noVend.
paths, err := noVend(path, onlyGo, suffix)
if err != nil {
- msg.Error("Failed to walk file tree: %s", err)
+ msg.Err("Failed to walk file tree: %s", err)
msg.Warn("FIXME: NoVendor should exit with non-zero exit code.")
return
}
diff --git a/action/plugin.go b/action/plugin.go
index 66da2ad..7e60ee5 100644
--- a/action/plugin.go
+++ b/action/plugin.go
@@ -48,12 +48,12 @@
proc, err := os.StartProcess(fullcmd, args, &pa)
if err != nil {
- msg.Error("Failed to execute %s: %s", cmd, err)
+ msg.Err("Failed to execute %s: %s", cmd, err)
os.Exit(98)
}
if _, err := proc.Wait(); err != nil {
- msg.Error(err.Error())
+ msg.Err(err.Error())
os.Exit(1)
}
}
diff --git a/action/remove.go b/action/remove.go
index 02a321d..bdf831b 100644
--- a/action/remove.go
+++ b/action/remove.go
@@ -28,7 +28,7 @@
confcopy.Imports = inst.List(confcopy)
if err := repo.SetReference(confcopy); err != nil {
- msg.Error("Failed to set references: %s", err)
+ msg.Err("Failed to set references: %s", err)
}
// TODO: Right now, there is no flag to enable this, so this will never be
diff --git a/action/update.go b/action/update.go
index 5d56a51..e86e04a 100644
--- a/action/update.go
+++ b/action/update.go
@@ -53,7 +53,7 @@
// from the right version of the package.
msg.Info("Setting references for remaining imports")
if err := repo.SetReference(confcopy); err != nil {
- msg.Error("Failed to set references: %s (Skip to cleanup)", err)
+ msg.Err("Failed to set references: %s (Skip to cleanup)", err)
}
}
// Vendored cleanup
@@ -79,7 +79,7 @@
}
lock := cfg.NewLockfile(confcopy.Imports, hash)
if err := lock.WriteFile(filepath.Join(base, gpath.LockFile)); err != nil {
- msg.Error("Could not write lock file to %s: %s", base, err)
+ msg.Err("Could not write lock file to %s: %s", base, err)
return
}
diff --git a/dependency/resolver.go b/dependency/resolver.go
index 19a10e7..1668f23 100644
--- a/dependency/resolver.go
+++ b/dependency/resolver.go
@@ -274,7 +274,7 @@
})
if err != nil {
- msg.Error("Failed to build an initial list of packages to scan: %s", err)
+ msg.Err("Failed to build an initial list of packages to scan: %s", err)
return []string{}, err
}
@@ -395,7 +395,7 @@
r.VersionHandler.SetVersion(dep)
} else if err2 != nil {
r.hadError[dep] = true
- msg.Error("Error looking for %s: %s", dep, err2)
+ msg.Err("Error looking for %s: %s", dep, err2)
} else {
r.hadError[dep] = true
// TODO (mpb): Should we toss this into a Handler to
@@ -404,7 +404,7 @@
}
} else {
r.hadError[dep] = true
- msg.Error("Error scanning %s: %s", dep, err)
+ msg.Err("Error scanning %s: %s", dep, err)
}
continue
}
@@ -529,12 +529,12 @@
e := r.queueUnseen(path, queue)
if err != nil {
failedDep = path
- //msg.Error("Failed to fetch dependency %s: %s", path, err)
+ //msg.Err("Failed to fetch dependency %s: %s", path, err)
}
return e
})
if err != nil && err != filepath.SkipDir {
- msg.Error("Dependency %s failed to resolve: %s.", failedDep, err)
+ msg.Err("Dependency %s failed to resolve: %s.", failedDep, err)
return []string{}, err
}
}
@@ -580,7 +580,7 @@
deps, err := r.imports(pkg)
if err != nil && !strings.HasPrefix(err.Error(), "no buildable Go source") {
- msg.Error("Could not find %s: %s", pkg, err)
+ msg.Err("Could not find %s: %s", pkg, err)
return err
// NOTE: If we uncomment this, we get lots of "no buildable Go source" errors,
// which don't ever seem to be helpful. They don't actually indicate an error
@@ -647,7 +647,7 @@
// Do we resolve here?
found, err := r.Handler.NotFound(imp)
if err != nil {
- msg.Error("Failed to fetch %s: %s", imp, err)
+ msg.Err("Failed to fetch %s: %s", imp, err)
}
if found {
buf = append(buf, filepath.Join(r.VendorDir, filepath.FromSlash(imp)))
@@ -666,7 +666,7 @@
case LocGopath:
found, err := r.Handler.OnGopath(imp)
if err != nil {
- msg.Error("Failed to fetch %s: %s", imp, err)
+ msg.Err("Failed to fetch %s: %s", imp, err)
}
// If the Handler marks this as found, we drop it into the buffer
// for subsequent processing. Otherwise, we assume that we're
diff --git a/dependency/resolver_test.go b/dependency/resolver_test.go
index e38b4a9..bb455c2 100644
--- a/dependency/resolver_test.go
+++ b/dependency/resolver_test.go
@@ -53,7 +53,7 @@
}
if len(l) < 4 {
- t.Errorf("Expected at least 4 deps, got %d: %s", len(l))
+ t.Errorf("Expected at least 4 deps, got %d", len(l))
}
}
diff --git a/glide.go b/glide.go
index 714da14..4a29d06 100644
--- a/glide.go
+++ b/glide.go
@@ -114,7 +114,7 @@
// Detect errors from the Before and After calls and exit on them.
if err := app.Run(os.Args); err != nil {
- msg.Error(err.Error())
+ msg.Err(err.Error())
os.Exit(1)
}
diff --git a/msg/msg.go b/msg/msg.go
index af949e7..b2a7bfe 100644
--- a/msg/msg.go
+++ b/msg/msg.go
@@ -95,23 +95,23 @@
Default.Warn(msg, args...)
}
-// Error logs and error.
-func (m *Messenger) Error(msg string, args ...interface{}) {
+// Err logs an error.
+func (m *Messenger) Err(msg string, args ...interface{}) {
prefix := m.Color(Red, "[ERROR] ")
m.Msg(prefix+msg, args...)
m.hasErrored = true
}
-// Error logs and error using the Default Messenger
-func Error(msg string, args ...interface{}) {
- Default.Error(msg, args...)
+// Err logs anderror using the Default Messenger
+func Err(msg string, args ...interface{}) {
+ Default.Err(msg, args...)
}
// Die prints an error message and immediately exits the application.
// If PanicOnDie is set to true a panic will occur instead of os.Exit being
// called.
func (m *Messenger) Die(msg string, args ...interface{}) {
- m.Error(msg, args...)
+ m.Err(msg, args...)
if m.PanicOnDie {
panic("trapped a Die() call")
}
diff --git a/repo/installer.go b/repo/installer.go
index 9c9f74b..1506652 100644
--- a/repo/installer.go
+++ b/repo/installer.go
@@ -245,7 +245,7 @@
case dep := <-ch:
dest := filepath.Join(i.VendorPath(), dep.Name)
if err := VcsUpdate(dep, dest, i.Home, i.UseCache, i.UseCacheGopath, i.UseGopath, i.Force, i.UpdateVendored); err != nil {
- msg.Error("Update failed for %s: %s\n", dep.Name, err)
+ msg.Err("Update failed for %s: %s\n", dep.Name, err)
// Capture the error while making sure the concurrent
// operations don't step on each other.
lock.Lock()
@@ -386,7 +386,7 @@
}
}
- msg.Error("Could not locate %s on the GOPATH, though it was found before.", pkg)
+ msg.Err("Could not locate %s on the GOPATH, though it was found before.", pkg)
return false, nil
}
@@ -468,7 +468,7 @@
}
}
} else if err != nil {
- msg.Error("Unable to import from %s. Err: %s", root, err)
+ msg.Err("Unable to import from %s. Err: %s", root, err)
e = err
}
}
diff --git a/repo/set_reference.go b/repo/set_reference.go
index 8cedb7e..f171813 100644
--- a/repo/set_reference.go
+++ b/repo/set_reference.go
@@ -32,7 +32,7 @@
select {
case dep := <-ch:
if err := VcsVersion(dep, cwd); err != nil {
- msg.Error("Failed to set version on %s to %s: %s\n", dep.Name, dep.Reference, err)
+ msg.Err("Failed to set version on %s to %s: %s\n", dep.Name, dep.Reference, err)
}
wg.Done()
case <-done:
diff --git a/repo/vcs.go b/repo/vcs.go
index e9b5c85..08be85f 100644
--- a/repo/vcs.go
+++ b/repo/vcs.go
@@ -63,7 +63,7 @@
msg.Info("%s is a vendored package. Updating.", dep.Name)
err = os.RemoveAll(dest)
if err != nil {
- msg.Error("Unable to update vendored dependency %s.\n", dep.Name)
+ msg.Err("Unable to update vendored dependency %s.\n", dep.Name)
return err
}
dep.UpdateAsVendored = true
@@ -226,7 +226,7 @@
}
}
if err := repo.UpdateVersion(ver); err != nil {
- msg.Error("Failed to set version to %s: %s\n", dep.Reference, err)
+ msg.Err("Failed to set version to %s: %s\n", dep.Reference, err)
return err
}
dep.Pin, err = repo.Version()
diff --git a/repo/vendored_cleanup.go b/repo/vendored_cleanup.go
index 6fa63e2..acbab91 100644
--- a/repo/vendored_cleanup.go
+++ b/repo/vendored_cleanup.go
@@ -27,13 +27,13 @@
cwd := filepath.Join(vend, dep.Name)
repo, err := dep.GetRepo(cwd)
if err != nil {
- msg.Error("Error cleaning up %s:%s", dep.Name, err)
+ msg.Err("Error cleaning up %s:%s", dep.Name, err)
continue
}
t := repo.Vcs()
err = os.RemoveAll(cwd + string(os.PathSeparator) + "." + string(t))
if err != nil {
- msg.Error("Error cleaning up VCS dir for %s:%s", dep.Name, err)
+ msg.Err("Error cleaning up VCS dir for %s:%s", dep.Name, err)
}
}