diff --git a/config.go b/config.go index 2a7e9c3..d953d94 100644 --- a/config.go +++ b/config.go @@ -22,7 +22,7 @@ package main -import "errors" +import "fmt" type config struct { Profs map[string]profile @@ -31,7 +31,7 @@ type config struct { func (this config) process(name, srcDir, dstDir string) error { prof, ok := this.Profs[name] if !ok { - return errors.New("Profile not found") + return fmt.Errorf("Profile not found: '%s'", name) } return prof.process(srcDir, dstDir, this) diff --git a/link.go b/link.go index 66b9557..961bcd9 100644 --- a/link.go +++ b/link.go @@ -23,7 +23,6 @@ package main import ( - "errors" "fmt" "log" "os" @@ -72,15 +71,15 @@ func (this link) process(srcDir, dstDir string) error { dstPath := path.Join(dstDir, this.Dst) if !path.IsAbs(dstPath) { - return errors.New(fmt.Sprintf("Destination path is not absolute: '%s'", dstPath)) + return fmt.Errorf("Destination path is not absolute: '%s'", dstPath) } if !path.IsAbs(srcPath) { - return errors.New(fmt.Sprintf("Source path is not absolute: '%s'", srcPath)) + return fmt.Errorf("Source path is not absolute: '%s'", srcPath) } if _, err := os.Stat(srcPath); os.IsNotExist(err) { - return errors.New(fmt.Sprintf("Source path does not exist in filesystem: '%s'", srcPath)) + return fmt.Errorf("Source path does not exist in filesystem: '%s'", srcPath) } if err := preparePath(dstPath, true, true); err != nil { diff --git a/profile.go b/profile.go index 009a1ad..e424bb6 100644 --- a/profile.go +++ b/profile.go @@ -22,7 +22,7 @@ package main -import "errors" +import "fmt" type profile struct { Deps []string @@ -33,7 +33,7 @@ func (this profile) process(srcDir, dstDir string, conf config) error { for _, name := range this.Deps { prof, ok := conf.Profs[name] if !ok { - return errors.New("Profile dependency not found") + return fmt.Errorf("Profile dependency not found: '%s'", name) } if err := prof.process(srcDir, dstDir, conf); err != nil {