Fixing silly flag test error

This commit is contained in:
Alex Yatskov 2015-11-08 10:18:19 +09:00
parent 3538840d72
commit 20746f6640
2 changed files with 2 additions and 3 deletions

View File

@ -48,9 +48,8 @@ func usage() {
} }
func main() { func main() {
homeDir := os.Getenv("HOME")
taskName := flag.String("task", "default", "name of task to execute") taskName := flag.String("task", "default", "name of task to execute")
dstDir := flag.String("dest", homeDir, "target directory for tasks") dstDir := flag.String("dest", os.Getenv("HOME"), "target directory for tasks")
force := flag.Bool("force", true, "create parent directories to target") force := flag.Bool("force", true, "create parent directories to target")
clobber := flag.Bool("clobber", false, "delete files and directories at target") clobber := flag.Bool("clobber", false, "delete files and directories at target")
verbose := flag.Bool("verbose", false, "verbose output") verbose := flag.Bool("verbose", false, "verbose output")

View File

@ -115,7 +115,7 @@ func processLink(params []string, conf *config) error {
dstPathAbs = path.Join(conf.dstDir, dstPath) dstPathAbs = path.Join(conf.dstDir, dstPath)
} }
if conf.flags&flagUnlink == 0 { if conf.flags&flagUnlink != flagUnlink {
if _, err := os.Stat(srcPathAbs); os.IsNotExist(err) { if _, err := os.Stat(srcPathAbs); os.IsNotExist(err) {
return fmt.Errorf("source path %s does not exist in filesystem", srcPathAbs) return fmt.Errorf("source path %s does not exist in filesystem", srcPathAbs)
} }