[Clean up] Reformat Tree
Run gofmt in jiri.
Change-Id: I2f029fa9c6223a9ffc75da2e4c0e0b875caef514
Reviewed-on: https://fuchsia-review.googlesource.com/c/jiri/+/678324
Reviewed-by: Nathan Mulcahey <nmulcahey@google.com>
Commit-Queue: Yuping Zhai <yupingz@google.com>
diff --git a/analytics_util/command.go b/analytics_util/command.go
index 15456a3..93373a9 100644
--- a/analytics_util/command.go
+++ b/analytics_util/command.go
@@ -20,9 +20,9 @@
// string values allowed to be tracked
var allowedStrings = map[string]struct{}{
- "always": struct{}{},
- "auto": struct{}{},
- "never": struct{}{},
+ "always": {},
+ "auto": {},
+ "never": {},
}
func newCommand(name string, flags map[string]string) *Command {
@@ -57,7 +57,7 @@
value := ""
if len(c.flags) > 0 {
keys := []string{}
- for k, _ := range c.flags {
+ for k := range c.flags {
keys = append(keys, k)
}
sort.Strings(keys)
diff --git a/envvar/envvar.go b/envvar/envvar.go
index b8a9c3d..1fb701f 100644
--- a/envvar/envvar.go
+++ b/envvar/envvar.go
@@ -297,7 +297,7 @@
// Mutating the returned map does not affect x.
func (x *Vars) ToMap() map[string]string {
snapshot := MergeMaps(x.base, x.deltaInsert)
- for key, _ := range x.deltaRemove {
+ for key := range x.deltaRemove {
delete(snapshot, key)
}
return snapshot
@@ -331,7 +331,7 @@
cp := value
deltas[key] = &cp
}
- for key, _ := range x.deltaRemove {
+ for key := range x.deltaRemove {
deltas[key] = nil
}
return deltas
diff --git a/gerrit/gerrit_test.go b/gerrit/gerrit_test.go
index 68cbc1a..dfebcf6 100644
--- a/gerrit/gerrit_test.go
+++ b/gerrit/gerrit_test.go
@@ -152,40 +152,40 @@
expectedTotal string
}
testCases := []testCase{
- testCase{
+ {
str: "message...\nMultiPart: a/3",
expectNoMatches: true,
},
- testCase{
+ {
str: "message...\n1/3",
expectNoMatches: true,
},
- testCase{
+ {
str: "message...\nMultiPart:1/2",
expectedIndex: "1",
expectedTotal: "2",
},
- testCase{
+ {
str: "message...\nMultiPart: 1/2",
expectedIndex: "1",
expectedTotal: "2",
},
- testCase{
+ {
str: "message...\nMultiPart: 1 /2",
expectedIndex: "1",
expectedTotal: "2",
},
- testCase{
+ {
str: "message...\nMultiPart: 1/ 2",
expectedIndex: "1",
expectedTotal: "2",
},
- testCase{
+ {
str: "message...\nMultiPart: 1 / 2",
expectedIndex: "1",
expectedTotal: "2",
},
- testCase{
+ {
str: "message...\nMultiPart: 123/234",
expectedIndex: "123",
expectedTotal: "234",
@@ -220,15 +220,15 @@
`
got, err := parseGitCookieFile(strings.NewReader(gitCookieFileContent))
expected := map[string]*credentials{
- "vanadium.googlesource.com": &credentials{
+ "vanadium.googlesource.com": {
username: "git-johndoe.example.com",
password: "12345",
},
- "vanadium-review.googlesource.com": &credentials{
+ "vanadium-review.googlesource.com": {
username: "git-johndoe.example.com",
password: "54321",
},
- ".googlesource.com": &credentials{
+ ".googlesource.com": {
username: "git-johndoe.example.com",
password: "12321",
},
@@ -252,7 +252,7 @@
`
got, err := parseGitCookieFile(strings.NewReader(gitCookieFileContentWithInvalidEntries))
expected := map[string]*credentials{
- "vanadium.googlesource.com": &credentials{
+ "vanadium.googlesource.com": {
username: "git-johndoe.example.com",
password: "12345",
},
@@ -274,11 +274,11 @@
`
got, err := parseNetrcFile(strings.NewReader(netrcFileContent))
expected := map[string]*credentials{
- "vanadium.googlesource.com": &credentials{
+ "vanadium.googlesource.com": {
username: "git-johndoe.example.com",
password: "12345",
},
- "vanadium-review.googlesource.com": &credentials{
+ "vanadium-review.googlesource.com": {
username: "git-johndoe.example.com",
password: "54321",
},
@@ -303,7 +303,7 @@
`
got, err := parseNetrcFile(strings.NewReader(netRcFileContentWithInvalidEntries))
expected := map[string]*credentials{
- "vanadium-review.googlesource.com": &credentials{
+ "vanadium-review.googlesource.com": {
username: "git-johndoe.example.com",
password: "54321",
},
@@ -326,21 +326,21 @@
}
testCases := []testCase{
// Normal case
- testCase{
+ {
ref: "ref/changes/12/3412/2",
expectedCL: 3412,
expectedPatchSet: 2,
},
// Error cases
- testCase{
+ {
ref: "ref/123",
expectErr: true,
},
- testCase{
+ {
ref: "ref/changes/12/a/2",
expectErr: true,
},
- testCase{
+ {
ref: "ref/changes/12/3412/a",
expectErr: true,
},
diff --git a/gerrit/multipart_test.go b/gerrit/multipart_test.go
index c9edf9c..4168516 100644
--- a/gerrit/multipart_test.go
+++ b/gerrit/multipart_test.go
@@ -129,37 +129,37 @@
// Tests for non-multipart CLs.
// Both prevCLsMap and curCLs are empty.
- testCase{
+ {
prevCLsMap: CLRefMap{},
curCLs: CLList{},
expected: []CLList{},
},
// prevCLsMap is empty, curCLs is not.
- testCase{
+ {
prevCLsMap: CLRefMap{},
curCLs: CLList{nonMultiPartCLs[0], nonMultiPartCLs[1]},
- expected: []CLList{CLList{nonMultiPartCLs[0]}, CLList{nonMultiPartCLs[1]}},
+ expected: []CLList{{nonMultiPartCLs[0]}, {nonMultiPartCLs[1]}},
},
// prevCLsMap is not empty, curCLs is.
- testCase{
+ {
prevCLsMap: CLRefMap{nonMultiPartCLs[0].Reference(): nonMultiPartCLs[0]},
curCLs: CLList{},
expected: []CLList{},
},
// prevCLsMap and curCLs are not empty, and they have overlapping refs.
- testCase{
+ {
prevCLsMap: CLRefMap{
nonMultiPartCLs[0].Reference(): nonMultiPartCLs[0],
nonMultiPartCLs[1].Reference(): nonMultiPartCLs[1],
},
curCLs: CLList{nonMultiPartCLs[1], nonMultiPartCLs[2]},
- expected: []CLList{CLList{nonMultiPartCLs[2]}},
+ expected: []CLList{{nonMultiPartCLs[2]}},
},
// prevCLsMap and curCLs are not empty, and they have NO overlapping refs.
- testCase{
+ {
prevCLsMap: CLRefMap{nonMultiPartCLs[0].Reference(): nonMultiPartCLs[0]},
curCLs: CLList{nonMultiPartCLs[1]},
- expected: []CLList{CLList{nonMultiPartCLs[1]}},
+ expected: []CLList{{nonMultiPartCLs[1]}},
},
////////////////////////////////
@@ -167,40 +167,40 @@
// len(curCLs) > len(prevCLsMap).
// And the CLs in curCLs have different topics.
- testCase{
+ {
prevCLsMap: CLRefMap{multiPartCLs[0].Reference(): multiPartCLs[0]},
curCLs: CLList{multiPartCLs[0], multiPartCLs[2]},
expected: []CLList{},
},
// len(curCLs) > len(prevCLsMap).
// And the CLs in curCLs form a complete multi part cls set.
- testCase{
+ {
prevCLsMap: CLRefMap{multiPartCLs[0].Reference(): multiPartCLs[0]},
curCLs: CLList{multiPartCLs[0], multiPartCLs[1]},
- expected: []CLList{CLList{multiPartCLs[0], multiPartCLs[1]}},
+ expected: []CLList{{multiPartCLs[0], multiPartCLs[1]}},
},
// len(curCLs) == len(prevCLsMap).
// And cl[6] has a larger patchset than multiPartCLs[4] with identical cl number.
- testCase{
+ {
prevCLsMap: CLRefMap{
multiPartCLs[0].Reference(): multiPartCLs[0],
multiPartCLs[1].Reference(): multiPartCLs[1],
},
curCLs: CLList{multiPartCLs[0], multiPartCLs[3]},
- expected: []CLList{CLList{multiPartCLs[0], multiPartCLs[3]}},
+ expected: []CLList{{multiPartCLs[0], multiPartCLs[3]}},
},
////////////////////////////////
// Tests for mixed.
- testCase{
+ {
prevCLsMap: CLRefMap{
multiPartCLs[0].Reference(): multiPartCLs[0],
multiPartCLs[1].Reference(): multiPartCLs[1],
},
curCLs: CLList{nonMultiPartCLs[0], multiPartCLs[0], multiPartCLs[3]},
expected: []CLList{
- CLList{nonMultiPartCLs[0]},
- CLList{multiPartCLs[0], multiPartCLs[3]},
+ {nonMultiPartCLs[0]},
+ {multiPartCLs[0], multiPartCLs[3]},
},
},
}
diff --git a/isatty/isatty.go b/isatty/isatty.go
index 0a3ad25..5925f72 100644
--- a/isatty/isatty.go
+++ b/isatty/isatty.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux || darwin
// +build linux darwin
package isatty
diff --git a/isatty/isatty_darwin.go b/isatty/isatty_darwin.go
index c6faabd..d97cac6 100644
--- a/isatty/isatty_darwin.go
+++ b/isatty/isatty_darwin.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin
// +build darwin
package isatty
diff --git a/isatty/isatty_dummy.go b/isatty/isatty_dummy.go
index c1932c9..b540d12 100644
--- a/isatty/isatty_dummy.go
+++ b/isatty/isatty_dummy.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !linux
-// +build !darwin
+//go:build !linux && !darwin
+// +build !linux,!darwin
package isatty
diff --git a/isatty/isatty_linux.go b/isatty/isatty_linux.go
index 5b21ce8..aed97e9 100644
--- a/isatty/isatty_linux.go
+++ b/isatty/isatty_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package isatty
diff --git a/osutil/exec_procfs.go b/osutil/exec_procfs.go
index cfa8fdc..17f5a3d 100644
--- a/osutil/exec_procfs.go
+++ b/osutil/exec_procfs.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux || netbsd || openbsd
// +build linux netbsd openbsd
package osutil
diff --git a/osutil/exec_sysctl.go b/osutil/exec_sysctl.go
index 1c5f57f..f01bd4a 100644
--- a/osutil/exec_sysctl.go
+++ b/osutil/exec_sysctl.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build freebsd || darwin
// +build freebsd darwin
package osutil
diff --git a/osutil/exec_windows.go b/osutil/exec_windows.go
index f47a4a3..00e5650 100644
--- a/osutil/exec_windows.go
+++ b/osutil/exec_windows.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build windows
// +build windows
package osutil
diff --git a/simplemr/mr.go b/simplemr/mr.go
index 15f19d2..408e95b 100644
--- a/simplemr/mr.go
+++ b/simplemr/mr.go
@@ -56,7 +56,7 @@
s.Lock()
defer s.Unlock()
keys := make([]string, 0, len(s.data))
- for k, _ := range s.data {
+ for k := range s.data {
keys = append(keys, k)
}
sort.Strings(keys)