mirror of https://github.com/perkeep/perkeep.git
make.go: pull cleanGoEnv out into a function
This commit is contained in:
parent
cca2466547
commit
58b0d0fa02
23
make.go
23
make.go
|
@ -149,14 +149,10 @@ func main() {
|
|||
args = append(args, "camlistore.org/cmd/cammount")
|
||||
}
|
||||
cmd := exec.Command("go", args...)
|
||||
for _, env := range os.Environ() {
|
||||
if strings.HasPrefix(env, "GOPATH=") || strings.HasPrefix(env, "GOBIN=") {
|
||||
continue
|
||||
}
|
||||
cmd.Env = append(cmd.Env, env)
|
||||
}
|
||||
cmd.Env = append(cmd.Env, "GOPATH="+goPath)
|
||||
cmd.Env = append(cmd.Env, "GOBIN="+binDir)
|
||||
cmd.Env = append(cleanGoEnv(),
|
||||
"GOPATH="+goPath,
|
||||
"GOBIN="+binDir,
|
||||
)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
if *verbose {
|
||||
|
@ -168,6 +164,17 @@ func main() {
|
|||
log.Printf("Success. Binaries are in %s", binDir)
|
||||
}
|
||||
|
||||
// cleanGoEnv returns a copy of the current environment with GOPATH and GOBIN removed.
|
||||
func cleanGoEnv() (clean []string) {
|
||||
for _, env := range os.Environ() {
|
||||
if strings.HasPrefix(env, "GOPATH=") || strings.HasPrefix(env, "GOBIN=") {
|
||||
continue
|
||||
}
|
||||
clean = append(clean, env)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// getVersion returns the version of Camlistore. Either from a VERSION file at the root,
|
||||
// or from git.
|
||||
func getVersion(camRoot string) string {
|
||||
|
|
Loading…
Reference in New Issue