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 { ...@@ -36,44 +36,44 @@ func MkEnv() []cfg.EnvVar {
b.Init() b.Init()
env := []cfg.EnvVar{ env := []cfg.EnvVar{
{"GOARCH", cfg.Goarch}, {Name: "GOARCH", Value: cfg.Goarch},
{"GOBIN", cfg.GOBIN}, {Name: "GOBIN", Value: cfg.GOBIN},
{"GOEXE", cfg.ExeSuffix}, {Name: "GOEXE", Value: cfg.ExeSuffix},
{"GOHOSTARCH", runtime.GOARCH}, {Name: "GOHOSTARCH", Value: runtime.GOARCH},
{"GOHOSTOS", runtime.GOOS}, {Name: "GOHOSTOS", Value: runtime.GOOS},
{"GOOS", cfg.Goos}, {Name: "GOOS", Value: cfg.Goos},
{"GOPATH", cfg.BuildContext.GOPATH}, {Name: "GOPATH", Value: cfg.BuildContext.GOPATH},
{"GORACE", os.Getenv("GORACE")}, {Name: "GORACE", Value: os.Getenv("GORACE")},
{"GOROOT", cfg.GOROOT}, {Name: "GOROOT", Value: cfg.GOROOT},
{"GOTOOLDIR", base.ToolDir}, {Name: "GOTOOLDIR", Value: base.ToolDir},
// disable escape codes in clang errors // disable escape codes in clang errors
{"TERM", "dumb"}, {Name: "TERM", Value: "dumb"},
} }
if work.GccgoBin != "" { if work.GccgoBin != "" {
env = append(env, cfg.EnvVar{"GCCGO", work.GccgoBin}) env = append(env, cfg.EnvVar{Name: "GCCGO", Value: work.GccgoBin})
} else { } else {
env = append(env, cfg.EnvVar{"GCCGO", work.GccgoName}) env = append(env, cfg.EnvVar{Name: "GCCGO", Value: work.GccgoName})
} }
switch cfg.Goarch { switch cfg.Goarch {
case "arm": case "arm":
env = append(env, cfg.EnvVar{"GOARM", os.Getenv("GOARM")}) env = append(env, cfg.EnvVar{Name: "GOARM", Value: os.Getenv("GOARM")})
case "386": 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(".") cmd := b.GccCmd(".")
env = append(env, cfg.EnvVar{"CC", cmd[0]}) env = append(env, cfg.EnvVar{Name: "CC", Value: cmd[0]})
env = append(env, cfg.EnvVar{"GOGCCFLAGS", strings.Join(cmd[3:], " ")}) env = append(env, cfg.EnvVar{Name: "GOGCCFLAGS", Value: strings.Join(cmd[3:], " ")})
cmd = b.GxxCmd(".") 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 { if cfg.BuildContext.CgoEnabled {
env = append(env, cfg.EnvVar{"CGO_ENABLED", "1"}) env = append(env, cfg.EnvVar{Name: "CGO_ENABLED", Value: "1"})
} else { } else {
env = append(env, cfg.EnvVar{"CGO_ENABLED", "0"}) env = append(env, cfg.EnvVar{Name: "CGO_ENABLED", Value: "0"})
} }
return env return env
...@@ -94,12 +94,12 @@ func ExtraEnvVars() []cfg.EnvVar { ...@@ -94,12 +94,12 @@ func ExtraEnvVars() []cfg.EnvVar {
b.Init() b.Init()
cppflags, cflags, cxxflags, fflags, ldflags := b.CFlags(&load.Package{}) cppflags, cflags, cxxflags, fflags, ldflags := b.CFlags(&load.Package{})
return []cfg.EnvVar{ return []cfg.EnvVar{
{"PKG_CONFIG", b.PkgconfigCmd()}, {Name: "PKG_CONFIG", Value: b.PkgconfigCmd()},
{"CGO_CFLAGS", strings.Join(cflags, " ")}, {Name: "CGO_CFLAGS", Value: strings.Join(cflags, " ")},
{"CGO_CPPFLAGS", strings.Join(cppflags, " ")}, {Name: "CGO_CPPFLAGS", Value: strings.Join(cppflags, " ")},
{"CGO_CXXFLAGS", strings.Join(cxxflags, " ")}, {Name: "CGO_CXXFLAGS", Value: strings.Join(cxxflags, " ")},
{"CGO_FFLAGS", strings.Join(fflags, " ")}, {Name: "CGO_FFLAGS", Value: strings.Join(fflags, " ")},
{"CGO_LDFLAGS", strings.Join(ldflags, " ")}, {Name: "CGO_LDFLAGS", Value: strings.Join(ldflags, " ")},
} }
} }
......
...@@ -96,9 +96,9 @@ func testMemRecords(a1, a2 uint64) ([]runtime.MemProfileRecord, int64) { ...@@ -96,9 +96,9 @@ func testMemRecords(a1, a2 uint64) ([]runtime.MemProfileRecord, int64) {
addr1, addr2 := uintptr(a1), uintptr(a2) addr1, addr2 := uintptr(a1), uintptr(a2)
rate := int64(512 * 1024) rate := int64(512 * 1024)
rec := []runtime.MemProfileRecord{ rec := []runtime.MemProfileRecord{
{4096, 1024, 4, 1, [32]uintptr{addr1, addr2}}, {AllocBytes: 4096, FreeBytes: 1024, AllocObjects: 4, FreeObjects: 1, Stack0: [32]uintptr{addr1, addr2}},
{512 * 1024, 0, 1, 0, [32]uintptr{addr2 + 1, addr2 + 2}}, {AllocBytes: 512 * 1024, FreeBytes: 0, AllocObjects: 1, FreeObjects: 0, Stack0: [32]uintptr{addr2 + 1, addr2 + 2}},
{512 * 1024, 512 * 1024, 1, 1, [32]uintptr{addr1 + 1, addr1 + 2, addr2 + 3}}, {AllocBytes: 512 * 1024, FreeBytes: 512 * 1024, AllocObjects: 1, FreeObjects: 1, Stack0: [32]uintptr{addr1 + 1, addr1 + 2, addr2 + 3}},
} }
return rec, rate 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