Skip to content

Commit a964f18

Browse files
web3-botStebalien
authored andcommitted
run gofmt -s
1 parent 15e8f79 commit a964f18

13 files changed

+51
-53
lines changed

cli/error_posix.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//+build !windows,!plan9
1+
//go:build !windows && !plan9
2+
// +build !windows,!plan9
23

34
package cli
45

cli/error_windows.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//+build windows
1+
//go:build windows
2+
// +build windows
23

34
package cli
45

cli/parse_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ func TestOptionParsing(t *testing.T) {
105105
cmds.DelimitedStringsOption(",", "delimstrings", "d", "comma delimited string array"),
106106
},
107107
Subcommands: map[string]*cmds.Command{
108-
"test": &cmds.Command{},
109-
"defaults": &cmds.Command{
108+
"test": {},
109+
"defaults": {
110110
Options: []cmds.Option{
111111
cmds.StringOption("opt", "o", "an option").WithDefault("def"),
112112
},
@@ -265,7 +265,7 @@ func TestDefaultOptionParsing(t *testing.T) {
265265

266266
cmd := &cmds.Command{
267267
Subcommands: map[string]*cmds.Command{
268-
"defaults": &cmds.Command{
268+
"defaults": {
269269
Options: []cmds.Option{
270270
cmds.StringOption("string", "s", "a string").WithDefault("foo"),
271271
cmds.StringsOption("strings1", "a", "a string array").WithDefault([]string{"foo"}),
@@ -435,18 +435,18 @@ func TestBodyArgs(t *testing.T) {
435435
cmds.StringArg("a", true, true, "some arg").EnableStdin(),
436436
},
437437
},
438-
"stdinenabled2args": &cmds.Command{
438+
"stdinenabled2args": {
439439
Arguments: []cmds.Argument{
440440
cmds.StringArg("a", true, false, "some arg"),
441441
cmds.StringArg("b", true, true, "another arg").EnableStdin(),
442442
},
443443
},
444-
"stdinenablednotvariadic": &cmds.Command{
444+
"stdinenablednotvariadic": {
445445
Arguments: []cmds.Argument{
446446
cmds.StringArg("a", true, false, "some arg").EnableStdin(),
447447
},
448448
},
449-
"stdinenablednotvariadic2args": &cmds.Command{
449+
"stdinenablednotvariadic2args": {
450450
Arguments: []cmds.Argument{
451451
cmds.StringArg("a", true, false, "some arg"),
452452
cmds.StringArg("b", true, false, "another arg").EnableStdin(),

cli/responseemitter_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (tc tcCloseWithError) Run(t *testing.T) {
4242

4343
func TestCloseWithError(t *testing.T) {
4444
tcs := []tcCloseWithError{
45-
tcCloseWithError{
45+
{
4646
stdout: bytes.NewBuffer(nil),
4747
stderr: bytes.NewBuffer(nil),
4848
exStdout: "a\n",
@@ -54,7 +54,7 @@ func TestCloseWithError(t *testing.T) {
5454
re.Emit("b")
5555
},
5656
},
57-
tcCloseWithError{
57+
{
5858
stdout: bytes.NewBuffer(nil),
5959
stderr: bytes.NewBuffer(nil),
6060
exStdout: "a\n",

cli/run_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
var root = &cmds.Command{
1313
Subcommands: map[string]*cmds.Command{
14-
"test": &cmds.Command{
14+
"test": {
1515
Run: func(req *cmds.Request, re cmds.ResponseEmitter, e cmds.Environment) error {
1616
err := cmds.EmitOnce(re, 42)
1717

command_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ func TestResolving(t *testing.T) {
130130
func TestWalking(t *testing.T) {
131131
cmdA := &Command{
132132
Subcommands: map[string]*Command{
133-
"b": &Command{},
134-
"B": &Command{},
133+
"b": {},
134+
"B": {},
135135
},
136136
}
137137
i := 0
@@ -181,7 +181,7 @@ func TestPostRun(t *testing.T) {
181181
defer cancel()
182182

183183
var testcases = []postRunTestCase{
184-
postRunTestCase{
184+
{
185185
length: 3,
186186
err: nil,
187187
emit: []interface{}{7},

examples/adder/cmd.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type AddStatus struct {
2424
var RootCmd = &cmds.Command{
2525
Subcommands: map[string]*cmds.Command{
2626
// the simplest way to make an adder
27-
"simpleAdd": &cmds.Command{
27+
"simpleAdd": {
2828
Arguments: []cmds.Argument{
2929
cmds.StringArg("summands", true, true, "values that are supposed to be summed"),
3030
},
@@ -48,7 +48,7 @@ var RootCmd = &cmds.Command{
4848
},
4949
},
5050
// a bit more sophisticated
51-
"encodeAdd": &cmds.Command{
51+
"encodeAdd": {
5252
Arguments: []cmds.Argument{
5353
cmds.StringArg("summands", true, true, "values that are supposed to be summed"),
5454
},
@@ -94,7 +94,7 @@ var RootCmd = &cmds.Command{
9494
},
9595
},
9696
// the best UX
97-
"postRunAdd": &cmds.Command{
97+
"postRunAdd": {
9898
Arguments: []cmds.Argument{
9999
cmds.StringArg("summands", true, true, "values that are supposed to be summed"),
100100
},
@@ -152,7 +152,7 @@ var RootCmd = &cmds.Command{
152152
},
153153
},
154154
// how to set program's return value
155-
"exitAdd": &cmds.Command{
155+
"exitAdd": {
156156
Arguments: []cmds.Argument{
157157
cmds.StringArg("summands", true, true, "values that are supposed to be summed"),
158158
},

executor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ var errGeneric = errors.New("an error occurred")
1212

1313
var root = &Command{
1414
Subcommands: map[string]*Command{
15-
"test": &Command{
15+
"test": {
1616
Run: func(req *Request, re ResponseEmitter, env Environment) error {
1717
re.Emit(env)
1818
return nil
1919
},
2020
},
21-
"testError": &Command{
21+
"testError": {
2222
Run: func(req *Request, re ResponseEmitter, env Environment) error {
2323
err := errGeneric
2424
if err != nil {

http/handler_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ var (
6565
},
6666

6767
Subcommands: map[string]*cmds.Command{
68-
"error": &cmds.Command{
68+
"error": {
6969
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
7070
return errors.New("an error occurred")
7171
},
7272
},
73-
"lateerror": &cmds.Command{
73+
"lateerror": {
7474
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
7575
re.Emit("some value")
7676
return errors.New("an error occurred")
7777
},
7878
Type: "",
7979
},
80-
"encode": &cmds.Command{
80+
"encode": {
8181
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
8282
return errors.New("an error occurred")
8383
},
@@ -89,7 +89,7 @@ var (
8989
}),
9090
},
9191
},
92-
"lateencode": &cmds.Command{
92+
"lateencode": {
9393
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
9494
re.Emit("hello")
9595
return errors.New("an error occurred")
@@ -105,7 +105,7 @@ var (
105105
}),
106106
},
107107
},
108-
"protoencode": &cmds.Command{
108+
"protoencode": {
109109
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
110110
return errors.New("an error occurred")
111111
},
@@ -117,7 +117,7 @@ var (
117117
}),
118118
},
119119
},
120-
"protolateencode": &cmds.Command{
120+
"protolateencode": {
121121
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
122122
re.Emit("hello")
123123
return errors.New("an error occurred")
@@ -130,7 +130,7 @@ var (
130130
}),
131131
},
132132
},
133-
"doubleclose": &cmds.Command{
133+
"doubleclose": {
134134
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
135135
t, ok := getTestingT(env)
136136
if !ok {
@@ -154,7 +154,7 @@ var (
154154
Type: "",
155155
},
156156

157-
"single": &cmds.Command{
157+
"single": {
158158
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
159159
t, ok := getTestingT(env)
160160
if !ok {
@@ -188,14 +188,14 @@ var (
188188
Type: "",
189189
},
190190

191-
"reader": &cmds.Command{
191+
"reader": {
192192
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
193193
buf := bytes.NewBufferString("the reader call returns a reader.")
194194
return re.Emit(buf)
195195
},
196196
},
197197

198-
"echo": &cmds.Command{
198+
"echo": {
199199
Arguments: []cmds.Argument{
200200
cmds.FileArg("file", true, false, "a file"),
201201
},
@@ -220,7 +220,7 @@ var (
220220
},
221221
},
222222

223-
"version": &cmds.Command{
223+
"version": {
224224
Helptext: cmds.HelpText{
225225
Tagline: "Show ipfs version information.",
226226
ShortDescription: "Returns the current version of ipfs and exits.",

http/parse_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import (
1515
func TestParse(t *testing.T) {
1616
root := &cmds.Command{
1717
Subcommands: map[string]*cmds.Command{
18-
"block": &cmds.Command{
18+
"block": {
1919
Subcommands: map[string]*cmds.Command{
20-
"put": &cmds.Command{
20+
"put": {
2121
Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error {
2222
defer resp.Close()
2323
resp.Emit("done")

0 commit comments

Comments
 (0)