mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-17 04:54:52 +00:00
Updated formating
Ran through testing individually for vendored Revel applications
This commit is contained in:
@@ -10,25 +10,27 @@ import (
|
||||
)
|
||||
|
||||
// Initialize the command based on the GO environment
|
||||
func CmdInit(c *exec.Cmd, basePath string) {
|
||||
func CmdInit(c *exec.Cmd, addGoPath bool, basePath string) {
|
||||
c.Dir = basePath
|
||||
// Dep does not like paths that are not real, convert all paths in go to real paths
|
||||
realPath := &bytes.Buffer{}
|
||||
for _, p := range filepath.SplitList(build.Default.GOPATH) {
|
||||
rp,_ := filepath.EvalSymlinks(p)
|
||||
if realPath.Len() > 0 {
|
||||
realPath.WriteString(string(filepath.ListSeparator))
|
||||
if addGoPath {
|
||||
for _, p := range filepath.SplitList(build.Default.GOPATH) {
|
||||
rp, _ := filepath.EvalSymlinks(p)
|
||||
if realPath.Len() > 0 {
|
||||
realPath.WriteString(string(filepath.ListSeparator))
|
||||
}
|
||||
realPath.WriteString(rp)
|
||||
}
|
||||
realPath.WriteString(rp)
|
||||
// Go 1.8 fails if we do not include the GOROOT
|
||||
c.Env = []string{"GOPATH=" + realPath.String(), "GOROOT=" + os.Getenv("GOROOT")}
|
||||
}
|
||||
// Go 1.8 fails if we do not include the GOROOT
|
||||
c.Env = []string{"GOPATH=" + realPath.String(), "GOROOT="+ os.Getenv("GOROOT")}
|
||||
// Fetch the rest of the env variables
|
||||
for _, e := range os.Environ() {
|
||||
pair := strings.Split(e, "=")
|
||||
if pair[0]=="GOPATH" || pair[0]=="GOROOT" {
|
||||
if pair[0] == "GOPATH" || pair[0] == "GOROOT" {
|
||||
continue
|
||||
}
|
||||
c.Env = append(c.Env,e)
|
||||
c.Env = append(c.Env, e)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user