Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

Commit

Permalink
Handle empty gopath (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
FugiTech authored and spenczar committed May 16, 2018
1 parent 9b19f82 commit 63c0f6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions do.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func setGoEnv() error {
}

prevGoPath := os.Getenv("GOPATH")
if prevGoPath == "" {
prevGoPath = filepath.Join(os.Getenv("HOME"), "go")
}
newGoPath := prevGoPath + string(os.PathListSeparator) + toolDirPath
return os.Setenv("GOPATH", newGoPath)
}
Expand Down
2 changes: 1 addition & 1 deletion tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func setEnvVar(cmd *exec.Cmd, key, val string) {
}
}
if !envSet {
env = append(cmd.Env, key+"="+val)
env = append(env, key+"="+val)
}

cmd.Env = env
Expand Down

0 comments on commit 63c0f6e

Please sign in to comment.