Skip to content

Commit 60372e3

Browse files
chore: gofumpt -w . (#202)
Signed-off-by: Sasha Melentyev <[email protected]>
1 parent 70a5e8c commit 60372e3

File tree

8 files changed

+34
-23
lines changed

8 files changed

+34
-23
lines changed

gomock/call.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ func newCall(t TestHelper, receiver any, method string, methodType reflect.Type,
7575
}
7676
return rets
7777
}}
78-
return &Call{t: t, receiver: receiver, method: method, methodType: methodType,
79-
args: mArgs, origin: origin, minCalls: 1, maxCalls: 1, actions: actions}
78+
return &Call{
79+
t: t, receiver: receiver, method: method, methodType: methodType,
80+
args: mArgs, origin: origin, minCalls: 1, maxCalls: 1, actions: actions,
81+
}
8082
}
8183

8284
// AnyTimes allows the expectation to be called 0 or more times

gomock/controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ type cancelReporter struct {
128128
func (r *cancelReporter) Errorf(format string, args ...any) {
129129
r.t.Errorf(format, args...)
130130
}
131+
131132
func (r *cancelReporter) Fatalf(format string, args ...any) {
132133
defer r.cancel()
133134
r.t.Fatalf(format, args...)
@@ -156,6 +157,7 @@ type nopTestHelper struct {
156157
func (h *nopTestHelper) Errorf(format string, args ...any) {
157158
h.t.Errorf(format, args...)
158159
}
160+
159161
func (h *nopTestHelper) Fatalf(format string, args ...any) {
160162
h.t.Fatalf(format, args...)
161163
}

gomock/controller_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,8 @@ func TestSetArgSlice(t *testing.T) {
563563
_, ctrl := createFixtures(t)
564564
subject := new(Subject)
565565

566-
var in = []byte{4, 5, 6}
567-
var set = []byte{1, 2, 3}
566+
in := []byte{4, 5, 6}
567+
set := []byte{1, 2, 3}
568568
ctrl.RecordCall(subject, "SetArgMethod", in, nil, nil).SetArg(0, set)
569569
ctrl.Call(subject, "SetArgMethod", in, nil, nil)
570570

@@ -584,8 +584,8 @@ func TestSetArgMap(t *testing.T) {
584584
_, ctrl := createFixtures(t)
585585
subject := new(Subject)
586586

587-
var in = map[any]any{"int": 1, "string": "random string", 1: "1", 0: 0}
588-
var set = map[any]any{"int": 2, 1: "2", 2: 100}
587+
in := map[any]any{"int": 1, "string": "random string", 1: "1", 0: 0}
588+
set := map[any]any{"int": 2, 1: "2", 2: 100}
589589
ctrl.RecordCall(subject, "SetArgMethod", nil, nil, in).SetArg(2, set)
590590
ctrl.Call(subject, "SetArgMethod", nil, nil, in)
591591

gomock/matchers_test.go

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ import (
2626
"go.uber.org/mock/gomock/internal/mock_gomock"
2727
)
2828

29-
type A []string
30-
type B struct {
31-
Name string
32-
}
29+
type (
30+
A []string
31+
B struct {
32+
Name string
33+
}
34+
)
3335

3436
func TestMatchers(t *testing.T) {
3537
type e any
@@ -39,21 +41,27 @@ func TestMatchers(t *testing.T) {
3941
yes, no []e
4042
}{
4143
{"test Any", gomock.Any(), []e{3, nil, "foo"}, nil},
42-
{"test AnyOf", gomock.AnyOf(gomock.Nil(), gomock.Len(2), 1, 2, 3),
44+
{
45+
"test AnyOf", gomock.AnyOf(gomock.Nil(), gomock.Len(2), 1, 2, 3),
4346
[]e{nil, "hi", "to", 1, 2, 3},
44-
[]e{"s", "", 0, 4, 10}},
47+
[]e{"s", "", 0, 4, 10},
48+
},
4549
{"test All", gomock.Eq(4), []e{4}, []e{3, "blah", nil, int64(4)}},
46-
{"test Nil", gomock.Nil(),
50+
{
51+
"test Nil", gomock.Nil(),
4752
[]e{nil, (error)(nil), (chan bool)(nil), (*int)(nil)},
48-
[]e{"", 0, make(chan bool), errors.New("err"), new(int)}},
53+
[]e{"", 0, make(chan bool), errors.New("err"), new(int)},
54+
},
4955
{"test Not", gomock.Not(gomock.Eq(4)), []e{3, "blah", nil, int64(4)}, []e{4}},
5056
{"test Regex", gomock.Regex("[0-9]{2}:[0-9]{2}"), []e{"23:02", "[23:02]: Hello world", []byte("23:02")}, []e{4, "23-02", "hello world", true, []byte("23-02")}},
5157
{"test All", gomock.All(gomock.Any(), gomock.Eq(4)), []e{4}, []e{3, "blah", nil, int64(4)}},
52-
{"test Len", gomock.Len(2),
58+
{
59+
"test Len", gomock.Len(2),
5360
[]e{[]int{1, 2}, "ab", map[string]int{"a": 0, "b": 1}, [2]string{"a", "b"}},
5461
[]e{[]int{1}, "a", 42, 42.0, false, [1]string{"a"}},
5562
},
56-
{"test assignable types", gomock.Eq(A{"a", "b"}),
63+
{
64+
"test assignable types", gomock.Eq(A{"a", "b"}),
5765
[]e{[]string{"a", "b"}, A{"a", "b"}},
5866
[]e{[]string{"a"}, A{"b"}},
5967
},

mockgen/internal/tests/sanitization/any/any.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ package any
22

33
// Any is a type of a package that tests the sanitization of imported packages
44
// named any.
5-
type Any struct {}
5+
type Any struct{}

mockgen/model/model_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ func TestImpPath(t *testing.T) {
99
nonVendor := "github.com/foo/bar"
1010
if nonVendor != impPath(nonVendor) {
1111
t.Errorf("")
12-
1312
}
1413
testCases := []struct {
1514
input string

mockgen/reflect.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,13 @@ func runInDir(program []byte, dir string) (*model.Package, error) {
142142
}
143143
}()
144144
const progSource = "prog.go"
145-
var progBinary = "prog.bin"
145+
progBinary := "prog.bin"
146146
if runtime.GOOS == "windows" {
147147
// Windows won't execute a program unless it has a ".exe" suffix.
148148
progBinary += ".exe"
149149
}
150150

151-
if err := os.WriteFile(filepath.Join(tmpDir, progSource), program, 0600); err != nil {
151+
if err := os.WriteFile(filepath.Join(tmpDir, progSource), program, 0o600); err != nil {
152152
return nil, err
153153
}
154154

sample/user.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ package user
55

66
// Random bunch of imports to test mockgen.
77
import (
8-
"io"
9-
10-
btz "bytes"
118
"hash"
9+
"io"
1210
"log"
1311
"net"
1412
"net/http"
1513

14+
btz "bytes"
15+
1616
// Two imports with the same base name.
1717
t1 "html/template"
1818

0 commit comments

Comments
 (0)