mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-11 18:54:31 +00:00
Update to logger
This commit is contained in:
@@ -11,24 +11,13 @@ import (
|
||||
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")}
|
||||
c.Env = []string{"GOPATH=" + build.Default.GOPATH, "GOROOT="+ os.Getenv("GOROOT")}
|
||||
// Fetch the rest of the env variables
|
||||
for _, e := range os.Environ() {
|
||||
pair := strings.Split(e, "=")
|
||||
if pair[0]=="GOPATH" {
|
||||
if pair[0]=="GOPATH" || pair[0]=="GOROOT" {
|
||||
continue
|
||||
}
|
||||
c.Env = append(c.Env,e)
|
||||
}
|
||||
}
|
||||
|
||||
// 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 ""
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ func MustChmod(filename string, mode os.FileMode) {
|
||||
// Called if panic
|
||||
func PanicOnError(err error, msg string) {
|
||||
if revErr, ok := err.(*Error); (ok && revErr != nil) || (!ok && err != nil) {
|
||||
Logger.Panicf("Abort: %s: %s %s\n", msg, revErr, err)
|
||||
Logger.Panicf("Abort: %s: %s %s", msg, revErr, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user