From 06a574d775b0a790e6223317bda7372ffda0aec2 Mon Sep 17 00:00:00 2001 From: Spencer Nelson Date: Tue, 21 Mar 2017 18:42:08 -0400 Subject: [PATCH] Use filepath, not path, for OS compatibility --- clean.go | 3 +-- do.go | 4 ++-- main.go | 2 +- tool.go | 5 ++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/clean.go b/clean.go index 9828d9c..00ec77b 100644 --- a/clean.go +++ b/clean.go @@ -4,7 +4,6 @@ import ( "fmt" "go/build" "os" - "path" "path/filepath" "strings" ) @@ -41,7 +40,7 @@ func clean(pkgs []string) { resolve("", pkgs) - base := path.Join(toolDirPath, "src") + base := filepath.Join(toolDirPath, "src") // Resolve any symlinks in the packages to keep, because we're going // to walk through the file system, so we need to trim stuff by diff --git a/do.go b/do.go index 28a5f52..dd15081 100644 --- a/do.go +++ b/do.go @@ -3,13 +3,13 @@ package main import ( "os" "os/exec" - "path" + "path/filepath" "strings" ) func setPath() (unset func()) { prevpath := os.Getenv("PATH") - newPath := path.Join(toolDirPath, "bin") + ":" + prevpath + newPath := filepath.Join(toolDirPath, "bin") + string(os.PathListSeparator) + prevpath _ = os.Setenv("PATH", newPath) return func() { _ = os.Setenv("PATH", prevpath) diff --git a/main.go b/main.go index b8f747a..c1c5e73 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( "path/filepath" ) -const version = "v1.0.1" +const version = "v1.0.3" var cacheDir = "" diff --git a/tool.go b/tool.go index af1bee3..895cd4b 100644 --- a/tool.go +++ b/tool.go @@ -4,7 +4,6 @@ import ( "fmt" "os" "os/exec" - "path" "path/filepath" "strings" @@ -19,11 +18,11 @@ type tool struct { } func (t *tool) path() string { - return path.Join(cacheDir, "src", t.Repository) + return filepath.Join(cacheDir, "src", t.Repository) } func (t *tool) executable() string { - return path.Base(t.Repository) + return filepath.Base(t.Repository) } func setEnvVar(cmd *exec.Cmd, key, val string) {