runtime: introduce GODEBUG env var

Currently it replaces GOGCTRACE env var (GODEBUG=gctrace=1).
The plan is to extend it with other type of debug tracing,
e.g. GODEBUG=gctrace=1,schedtrace=100.

R=rsc
CC=bradfitz, daniel.morsing, gobot, golang-dev
https://golang.org/cl/10026045
This commit is contained in:
Dmitriy Vyukov 2013-06-28 18:37:06 +04:00
parent 1e112cd59f
commit 4b536a550f
8 changed files with 53 additions and 25 deletions

View file

@ -14,7 +14,7 @@ import (
"text/template"
)
// testEnv excludes GOGCTRACE from the environment
// testEnv excludes GODEBUG from the environment
// to prevent its output from breaking tests that
// are trying to parse other command output.
func testEnv(cmd *exec.Cmd) *exec.Cmd {
@ -22,7 +22,7 @@ func testEnv(cmd *exec.Cmd) *exec.Cmd {
panic("environment already set")
}
for _, env := range os.Environ() {
if strings.HasPrefix(env, "GOGCTRACE=") {
if strings.HasPrefix(env, "GODEBUG=") {
continue
}
cmd.Env = append(cmd.Env, env)