Cleanup
This commit is contained in:
parent
b548ed7d15
commit
52b647e16d
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "errors"
|
import "fmt"
|
||||||
|
|
||||||
type config struct {
|
type config struct {
|
||||||
Profs map[string]profile
|
Profs map[string]profile
|
||||||
@ -31,7 +31,7 @@ type config struct {
|
|||||||
func (this config) process(name, srcDir, dstDir string) error {
|
func (this config) process(name, srcDir, dstDir string) error {
|
||||||
prof, ok := this.Profs[name]
|
prof, ok := this.Profs[name]
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("Profile not found")
|
return fmt.Errorf("Profile not found: '%s'", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
return prof.process(srcDir, dstDir, this)
|
return prof.process(srcDir, dstDir, this)
|
||||||
|
7
link.go
7
link.go
@ -23,7 +23,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
@ -72,15 +71,15 @@ func (this link) process(srcDir, dstDir string) error {
|
|||||||
dstPath := path.Join(dstDir, this.Dst)
|
dstPath := path.Join(dstDir, this.Dst)
|
||||||
|
|
||||||
if !path.IsAbs(dstPath) {
|
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) {
|
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) {
|
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 {
|
if err := preparePath(dstPath, true, true); err != nil {
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "errors"
|
import "fmt"
|
||||||
|
|
||||||
type profile struct {
|
type profile struct {
|
||||||
Deps []string
|
Deps []string
|
||||||
@ -33,7 +33,7 @@ func (this profile) process(srcDir, dstDir string, conf config) error {
|
|||||||
for _, name := range this.Deps {
|
for _, name := range this.Deps {
|
||||||
prof, ok := conf.Profs[name]
|
prof, ok := conf.Profs[name]
|
||||||
if !ok {
|
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 {
|
if err := prof.process(srcDir, dstDir, conf); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user