1 Star 0 Fork 0

api-go/revel-cmd

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
command.go 562 Bytes
Copy Edit Raw Blame History
NotZippy authored 2018-09-27 21:08 . Enhancements to Revel command
package utils
import (
"go/build"
"os"
"os/exec"
"strings"
)
// Initialize the command based on the GO environment
func CmdInit(c *exec.Cmd, basePath string) {
c.Dir = basePath
// Go 1.8 fails if we do not include the GOROOT
c.Env = []string{"GOPATH=" + build.Default.GOPATH, "PATH=" + GetEnv("PATH"), "GOROOT="+ GetEnv("GOROOT")}
}
// Returns an environment variable
func GetEnv(name string) string {
for _, v := range os.Environ() {
split := strings.Split(v, "=")
if split[0] == name {
return strings.Join(split[1:], "")
}
}
return ""
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/netscript/revel-cmd.git
git@gitee.com:netscript/revel-cmd.git
netscript
revel-cmd
revel-cmd
v0.20.1

Search