Commit cc2a52ad authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

all: use keyed composite literals

Makes vet happy.

Change-Id: I7250f283c96e82b9796c5672a0a143ba7568fa63
Reviewed-on: https://go-review.googlesource.com/36937
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent c0165a38
......@@ -36,44 +36,44 @@ func MkEnv() []cfg.EnvVar {
b.Init()
env := []cfg.EnvVar{
{"GOARCH", cfg.Goarch},
{"GOBIN", cfg.GOBIN},
{"GOEXE", cfg.ExeSuffix},
{"GOHOSTARCH", runtime.GOARCH},
{"GOHOSTOS", runtime.GOOS},
{"GOOS", cfg.Goos},
{"GOPATH", cfg.BuildContext.GOPATH},
{"GORACE", os.Getenv("GORACE")},
{"GOROOT", cfg.GOROOT},
{"GOTOOLDIR", base.ToolDir},
{Name: "GOARCH", Value: cfg.Goarch},
{Name: "GOBIN", Value: cfg.GOBIN},
{Name: "GOEXE", Value: cfg.ExeSuffix},
{Name: "GOHOSTARCH", Value: runtime.GOARCH},
{Name: "GOHOSTOS", Value: runtime.GOOS},
{Name: "GOOS", Value: cfg.Goos},
{Name: "GOPATH", Value: cfg.BuildContext.GOPATH},
{Name: "GORACE", Value: os.Getenv("GORACE")},
{Name: "GOROOT", Value: cfg.GOROOT},
{Name: "GOTOOLDIR", Value: base.ToolDir},
// disable escape codes in clang errors
{"TERM", "dumb"},
{Name: "TERM", Value: "dumb"},
}
if work.GccgoBin != "" {
env = append(env, cfg.EnvVar{"GCCGO", work.GccgoBin})
env = append(env, cfg.EnvVar{Name: "GCCGO", Value: work.GccgoBin})
} else {
env = append(env, cfg.EnvVar{"GCCGO", work.GccgoName})
env = append(env, cfg.EnvVar{Name: "GCCGO", Value: work.GccgoName})
}
switch cfg.Goarch {
case "arm":
env = append(env, cfg.EnvVar{"GOARM", os.Getenv("GOARM")})
env = append(env, cfg.EnvVar{Name: "GOARM", Value: os.Getenv("GOARM")})
case "386":
env = append(env, cfg.EnvVar{"GO386", os.Getenv("GO386")})
env = append(env, cfg.EnvVar{Name: "GO386", Value: os.Getenv("GO386")})
}
cmd := b.GccCmd(".")
env = append(env, cfg.EnvVar{"CC", cmd[0]})
env = append(env, cfg.EnvVar{"GOGCCFLAGS", strings.Join(cmd[3:], " ")})
env = append(env, cfg.EnvVar{Name: "CC", Value: cmd[0]})
env = append(env, cfg.EnvVar{Name: "GOGCCFLAGS", Value: strings.Join(cmd[3:], " ")})
cmd = b.GxxCmd(".")
env = append(env, cfg.EnvVar{"CXX", cmd[0]})
env = append(env, cfg.EnvVar{Name: "CXX", Value: cmd[0]})
if cfg.BuildContext.CgoEnabled {
env = append(env, cfg.EnvVar{"CGO_ENABLED", "1"})
env = append(env, cfg.EnvVar{Name: "CGO_ENABLED", Value: "1"})
} else {
env = append(env, cfg.EnvVar{"CGO_ENABLED", "0"})
env = append(env, cfg.EnvVar{Name: "CGO_ENABLED", Value: "0"})
}
return env
......@@ -94,12 +94,12 @@ func ExtraEnvVars() []cfg.EnvVar {
b.Init()
cppflags, cflags, cxxflags, fflags, ldflags := b.CFlags(&load.Package{})
return []cfg.EnvVar{
{"PKG_CONFIG", b.PkgconfigCmd()},
{"CGO_CFLAGS", strings.Join(cflags, " ")},
{"CGO_CPPFLAGS", strings.Join(cppflags, " ")},
{"CGO_CXXFLAGS", strings.Join(cxxflags, " ")},
{"CGO_FFLAGS", strings.Join(fflags, " ")},
{"CGO_LDFLAGS", strings.Join(ldflags, " ")},
{Name: "PKG_CONFIG", Value: b.PkgconfigCmd()},
{Name: "CGO_CFLAGS", Value: strings.Join(cflags, " ")},
{Name: "CGO_CPPFLAGS", Value: strings.Join(cppflags, " ")},
{Name: "CGO_CXXFLAGS", Value: strings.Join(cxxflags, " ")},
{Name: "CGO_FFLAGS", Value: strings.Join(fflags, " ")},
{Name: "CGO_LDFLAGS", Value: strings.Join(ldflags, " ")},
}
}
......
......@@ -96,9 +96,9 @@ func testMemRecords(a1, a2 uint64) ([]runtime.MemProfileRecord, int64) {
addr1, addr2 := uintptr(a1), uintptr(a2)
rate := int64(512 * 1024)
rec := []runtime.MemProfileRecord{
{4096, 1024, 4, 1, [32]uintptr{addr1, addr2}},
{512 * 1024, 0, 1, 0, [32]uintptr{addr2 + 1, addr2 + 2}},
{512 * 1024, 512 * 1024, 1, 1, [32]uintptr{addr1 + 1, addr1 + 2, addr2 + 3}},
{AllocBytes: 4096, FreeBytes: 1024, AllocObjects: 4, FreeObjects: 1, Stack0: [32]uintptr{addr1, addr2}},
{AllocBytes: 512 * 1024, FreeBytes: 0, AllocObjects: 1, FreeObjects: 0, Stack0: [32]uintptr{addr2 + 1, addr2 + 2}},
{AllocBytes: 512 * 1024, FreeBytes: 512 * 1024, AllocObjects: 1, FreeObjects: 1, Stack0: [32]uintptr{addr1 + 1, addr1 + 2, addr2 + 3}},
}
return rec, rate
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment