Skip to content

Commit cc2a52a

Browse files
committed
all: use keyed composite literals
Makes vet happy. Change-Id: I7250f283c96e82b9796c5672a0a143ba7568fa63 Reviewed-on: https://go-review.googlesource.com/36937 Run-TryBot: Josh Bleecher Snyder <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent c0165a3 commit cc2a52a

2 files changed

Lines changed: 29 additions & 29 deletions

File tree

src/cmd/go/internal/envcmd/env.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,44 +36,44 @@ func MkEnv() []cfg.EnvVar {
3636
b.Init()
3737

3838
env := []cfg.EnvVar{
39-
{"GOARCH", cfg.Goarch},
40-
{"GOBIN", cfg.GOBIN},
41-
{"GOEXE", cfg.ExeSuffix},
42-
{"GOHOSTARCH", runtime.GOARCH},
43-
{"GOHOSTOS", runtime.GOOS},
44-
{"GOOS", cfg.Goos},
45-
{"GOPATH", cfg.BuildContext.GOPATH},
46-
{"GORACE", os.Getenv("GORACE")},
47-
{"GOROOT", cfg.GOROOT},
48-
{"GOTOOLDIR", base.ToolDir},
39+
{Name: "GOARCH", Value: cfg.Goarch},
40+
{Name: "GOBIN", Value: cfg.GOBIN},
41+
{Name: "GOEXE", Value: cfg.ExeSuffix},
42+
{Name: "GOHOSTARCH", Value: runtime.GOARCH},
43+
{Name: "GOHOSTOS", Value: runtime.GOOS},
44+
{Name: "GOOS", Value: cfg.Goos},
45+
{Name: "GOPATH", Value: cfg.BuildContext.GOPATH},
46+
{Name: "GORACE", Value: os.Getenv("GORACE")},
47+
{Name: "GOROOT", Value: cfg.GOROOT},
48+
{Name: "GOTOOLDIR", Value: base.ToolDir},
4949

5050
// disable escape codes in clang errors
51-
{"TERM", "dumb"},
51+
{Name: "TERM", Value: "dumb"},
5252
}
5353

5454
if work.GccgoBin != "" {
55-
env = append(env, cfg.EnvVar{"GCCGO", work.GccgoBin})
55+
env = append(env, cfg.EnvVar{Name: "GCCGO", Value: work.GccgoBin})
5656
} else {
57-
env = append(env, cfg.EnvVar{"GCCGO", work.GccgoName})
57+
env = append(env, cfg.EnvVar{Name: "GCCGO", Value: work.GccgoName})
5858
}
5959

6060
switch cfg.Goarch {
6161
case "arm":
62-
env = append(env, cfg.EnvVar{"GOARM", os.Getenv("GOARM")})
62+
env = append(env, cfg.EnvVar{Name: "GOARM", Value: os.Getenv("GOARM")})
6363
case "386":
64-
env = append(env, cfg.EnvVar{"GO386", os.Getenv("GO386")})
64+
env = append(env, cfg.EnvVar{Name: "GO386", Value: os.Getenv("GO386")})
6565
}
6666

6767
cmd := b.GccCmd(".")
68-
env = append(env, cfg.EnvVar{"CC", cmd[0]})
69-
env = append(env, cfg.EnvVar{"GOGCCFLAGS", strings.Join(cmd[3:], " ")})
68+
env = append(env, cfg.EnvVar{Name: "CC", Value: cmd[0]})
69+
env = append(env, cfg.EnvVar{Name: "GOGCCFLAGS", Value: strings.Join(cmd[3:], " ")})
7070
cmd = b.GxxCmd(".")
71-
env = append(env, cfg.EnvVar{"CXX", cmd[0]})
71+
env = append(env, cfg.EnvVar{Name: "CXX", Value: cmd[0]})
7272

7373
if cfg.BuildContext.CgoEnabled {
74-
env = append(env, cfg.EnvVar{"CGO_ENABLED", "1"})
74+
env = append(env, cfg.EnvVar{Name: "CGO_ENABLED", Value: "1"})
7575
} else {
76-
env = append(env, cfg.EnvVar{"CGO_ENABLED", "0"})
76+
env = append(env, cfg.EnvVar{Name: "CGO_ENABLED", Value: "0"})
7777
}
7878

7979
return env
@@ -94,12 +94,12 @@ func ExtraEnvVars() []cfg.EnvVar {
9494
b.Init()
9595
cppflags, cflags, cxxflags, fflags, ldflags := b.CFlags(&load.Package{})
9696
return []cfg.EnvVar{
97-
{"PKG_CONFIG", b.PkgconfigCmd()},
98-
{"CGO_CFLAGS", strings.Join(cflags, " ")},
99-
{"CGO_CPPFLAGS", strings.Join(cppflags, " ")},
100-
{"CGO_CXXFLAGS", strings.Join(cxxflags, " ")},
101-
{"CGO_FFLAGS", strings.Join(fflags, " ")},
102-
{"CGO_LDFLAGS", strings.Join(ldflags, " ")},
97+
{Name: "PKG_CONFIG", Value: b.PkgconfigCmd()},
98+
{Name: "CGO_CFLAGS", Value: strings.Join(cflags, " ")},
99+
{Name: "CGO_CPPFLAGS", Value: strings.Join(cppflags, " ")},
100+
{Name: "CGO_CXXFLAGS", Value: strings.Join(cxxflags, " ")},
101+
{Name: "CGO_FFLAGS", Value: strings.Join(fflags, " ")},
102+
{Name: "CGO_LDFLAGS", Value: strings.Join(ldflags, " ")},
103103
}
104104
}
105105

src/runtime/pprof/protomem_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ func testMemRecords(a1, a2 uint64) ([]runtime.MemProfileRecord, int64) {
9696
addr1, addr2 := uintptr(a1), uintptr(a2)
9797
rate := int64(512 * 1024)
9898
rec := []runtime.MemProfileRecord{
99-
{4096, 1024, 4, 1, [32]uintptr{addr1, addr2}},
100-
{512 * 1024, 0, 1, 0, [32]uintptr{addr2 + 1, addr2 + 2}},
101-
{512 * 1024, 512 * 1024, 1, 1, [32]uintptr{addr1 + 1, addr1 + 2, addr2 + 3}},
99+
{AllocBytes: 4096, FreeBytes: 1024, AllocObjects: 4, FreeObjects: 1, Stack0: [32]uintptr{addr1, addr2}},
100+
{AllocBytes: 512 * 1024, FreeBytes: 0, AllocObjects: 1, FreeObjects: 0, Stack0: [32]uintptr{addr2 + 1, addr2 + 2}},
101+
{AllocBytes: 512 * 1024, FreeBytes: 512 * 1024, AllocObjects: 1, FreeObjects: 1, Stack0: [32]uintptr{addr1 + 1, addr1 + 2, addr2 + 3}},
102102
}
103103
return rec, rate
104104
}

0 commit comments

Comments
 (0)