Change the errors.New() with fmt.Errof

Upstream-commit: b2cf5041cd9a491b40b0a15c152655264f854d6b
Component: engine
This commit is contained in:
creack
2013-03-15 03:58:43 -07:00
parent 49d832751e
commit 5a0177291c
2 changed files with 6 additions and 6 deletions
+2 -3
View File
@@ -1,7 +1,6 @@
package fs
import (
"errors"
"fmt"
"github.com/dotcloud/docker/fake"
"github.com/dotcloud/docker/future"
@@ -261,7 +260,7 @@ func healthCheck(store *Store) error {
for _, img := range images {
// Check for duplicate IDs per path
if _, exists := IDs[img.Id]; exists {
return errors.New(fmt.Sprintf("Duplicate ID: %s", img.Id))
return fmt.Errorf("Duplicate ID: %s", img.Id)
} else {
IDs[img.Id] = true
}
@@ -274,7 +273,7 @@ func healthCheck(store *Store) error {
// Check non-existing parents
for parent := range parents {
if _, exists := parents[parent]; !exists {
return errors.New("Reference to non-registered parent: " + parent)
return fmt.Errorf("Reference to non-registered parent: %s", parent)
}
}
return nil
+4 -3
View File
@@ -1,6 +1,7 @@
package docker
import (
"fmt"
"github.com/dotcloud/docker/fake"
"github.com/dotcloud/docker/fs"
"io/ioutil"
@@ -9,7 +10,7 @@ import (
)
// Look for inconsistencies in a store.
func healthCheck(store *Store) error {
func healthCheck(store *fs.Store) error {
parents := make(map[string]bool)
paths, err := store.Paths()
if err != nil {
@@ -24,7 +25,7 @@ func healthCheck(store *Store) error {
for _, img := range images {
// Check for duplicate IDs per path
if _, exists := IDs[img.Id]; exists {
return errors.New(fmt.Sprintf("Duplicate ID: %s", img.Id))
return fmt.Errorf("Duplicate ID: %s", img.Id)
} else {
IDs[img.Id] = true
}
@@ -37,7 +38,7 @@ func healthCheck(store *Store) error {
// Check non-existing parents
for parent := range parents {
if _, exists := parents[parent]; !exists {
return errors.New("Reference to non-registered parent: " + parent)
return fmt.Errorf("Reference to non-registered parent: %s", parent)
}
}
return nil