Skip to content

Commit 8c5f817

Browse files
committed
Fix recvtype warn
1 parent 5289a39 commit 8c5f817

File tree

8 files changed

+45
-43
lines changed

8 files changed

+45
-43
lines changed

capturer.go

+28-28
Original file line numberDiff line numberDiff line change
@@ -48,168 +48,168 @@ type Capturer interface {
4848

4949
type capturers []Capturer
5050

51-
func (cs capturers) captureStart(trs Trails, bookPath, desc string) {
51+
func (cs capturers) captureStart(trs Trails, bookPath, desc string) { //nostyle:recvtype
5252
for _, c := range cs {
5353
c.CaptureStart(trs, bookPath, desc)
5454
}
5555
}
5656

57-
func (cs capturers) captureResult(trs Trails, result *RunResult) {
57+
func (cs capturers) captureResult(trs Trails, result *RunResult) { //nostyle:recvtype
5858
for _, c := range cs {
5959
c.CaptureResult(trs, result)
6060
}
6161
}
6262

63-
func (cs capturers) captureEnd(trs Trails, bookPath, desc string) {
63+
func (cs capturers) captureEnd(trs Trails, bookPath, desc string) { //nostyle:recvtype
6464
for _, c := range cs {
6565
c.CaptureEnd(trs, bookPath, desc)
6666
}
6767
}
6868

69-
func (cs capturers) captureHTTPRequest(name string, req *http.Request) {
69+
func (cs capturers) captureHTTPRequest(name string, req *http.Request) { //nostyle:recvtype
7070
for _, c := range cs {
7171
c.CaptureHTTPRequest(name, req)
7272
}
7373
}
7474

75-
func (cs capturers) captureHTTPResponse(name string, res *http.Response) {
75+
func (cs capturers) captureHTTPResponse(name string, res *http.Response) { //nostyle:recvtype
7676
for _, c := range cs {
7777
c.CaptureHTTPResponse(name, res)
7878
}
7979
}
8080

81-
func (cs capturers) captureGRPCStart(name string, typ GRPCType, service, method string) {
81+
func (cs capturers) captureGRPCStart(name string, typ GRPCType, service, method string) { //nostyle:recvtype
8282
for _, c := range cs {
8383
c.CaptureGRPCStart(name, typ, service, method)
8484
}
8585
}
86-
func (cs capturers) captureGRPCRequestHeaders(h metadata.MD) {
86+
func (cs capturers) captureGRPCRequestHeaders(h metadata.MD) { //nostyle:recvtype
8787
for _, c := range cs {
8888
c.CaptureGRPCRequestHeaders(h)
8989
}
9090
}
9191

92-
func (cs capturers) captureGRPCRequestMessage(m map[string]any) {
92+
func (cs capturers) captureGRPCRequestMessage(m map[string]any) { //nostyle:recvtype
9393
for _, c := range cs {
9494
c.CaptureGRPCRequestMessage(m)
9595
}
9696
}
9797

98-
func (cs capturers) captureGRPCResponseStatus(s *status.Status) {
98+
func (cs capturers) captureGRPCResponseStatus(s *status.Status) { //nostyle:recvtype
9999
for _, c := range cs {
100100
c.CaptureGRPCResponseStatus(s)
101101
}
102102
}
103103

104-
func (cs capturers) captureGRPCResponseHeaders(h metadata.MD) {
104+
func (cs capturers) captureGRPCResponseHeaders(h metadata.MD) { //nostyle:recvtype
105105
for _, c := range cs {
106106
c.CaptureGRPCResponseHeaders(h)
107107
}
108108
}
109109

110-
func (cs capturers) captureGRPCResponseMessage(m map[string]any) {
110+
func (cs capturers) captureGRPCResponseMessage(m map[string]any) { //nostyle:recvtype
111111
for _, c := range cs {
112112
c.CaptureGRPCResponseMessage(m)
113113
}
114114
}
115115

116-
func (cs capturers) captureGRPCResponseTrailers(t metadata.MD) {
116+
func (cs capturers) captureGRPCResponseTrailers(t metadata.MD) { //nostyle:recvtype
117117
for _, c := range cs {
118118
c.CaptureGRPCResponseTrailers(t)
119119
}
120120
}
121121

122-
func (cs capturers) captureGRPCClientClose() {
122+
func (cs capturers) captureGRPCClientClose() { //nostyle:recvtype
123123
for _, c := range cs {
124124
c.CaptureGRPCClientClose()
125125
}
126126
}
127127

128-
func (cs capturers) captureGRPCEnd(name string, typ GRPCType, service, method string) {
128+
func (cs capturers) captureGRPCEnd(name string, typ GRPCType, service, method string) { //nostyle:recvtype
129129
for _, c := range cs {
130130
c.CaptureGRPCEnd(name, typ, service, method)
131131
}
132132
}
133133

134-
func (cs capturers) captureCDPStart(name string) {
134+
func (cs capturers) captureCDPStart(name string) { //nostyle:recvtype
135135
for _, c := range cs {
136136
c.CaptureCDPStart(name)
137137
}
138138
}
139139

140-
func (cs capturers) captureCDPAction(a CDPAction) {
140+
func (cs capturers) captureCDPAction(a CDPAction) { //nostyle:recvtype
141141
for _, c := range cs {
142142
c.CaptureCDPAction(a)
143143
}
144144
}
145145

146-
func (cs capturers) captureCDPResponse(a CDPAction, res map[string]any) {
146+
func (cs capturers) captureCDPResponse(a CDPAction, res map[string]any) { //nostyle:recvtype
147147
for _, c := range cs {
148148
c.CaptureCDPResponse(a, res)
149149
}
150150
}
151151

152-
func (cs capturers) captureCDPEnd(name string) {
152+
func (cs capturers) captureCDPEnd(name string) { //nostyle:recvtype
153153
for _, c := range cs {
154154
c.CaptureCDPEnd(name)
155155
}
156156
}
157157

158-
func (cs capturers) captureSSHCommand(command string) {
158+
func (cs capturers) captureSSHCommand(command string) { //nostyle:recvtype
159159
for _, c := range cs {
160160
c.CaptureSSHCommand(command)
161161
}
162162
}
163163

164-
func (cs capturers) captureSSHStdout(stdout string) {
164+
func (cs capturers) captureSSHStdout(stdout string) { //nostyle:recvtype
165165
for _, c := range cs {
166166
c.CaptureSSHStdout(stdout)
167167
}
168168
}
169169

170-
func (cs capturers) captureSSHStderr(stderr string) {
170+
func (cs capturers) captureSSHStderr(stderr string) { //nostyle:recvtype
171171
for _, c := range cs {
172172
c.CaptureSSHStderr(stderr)
173173
}
174174
}
175175

176-
func (cs capturers) captureDBStatement(name string, stmt string) {
176+
func (cs capturers) captureDBStatement(name string, stmt string) { //nostyle:recvtype
177177
for _, c := range cs {
178178
c.CaptureDBStatement(name, stmt)
179179
}
180180
}
181181

182-
func (cs capturers) captureDBResponse(name string, res *DBResponse) {
182+
func (cs capturers) captureDBResponse(name string, res *DBResponse) { //nostyle:recvtype
183183
for _, c := range cs {
184184
c.CaptureDBResponse(name, res)
185185
}
186186
}
187187

188-
func (cs capturers) captureExecCommand(command string) {
188+
func (cs capturers) captureExecCommand(command string) { //nostyle:recvtype
189189
for _, c := range cs {
190190
c.CaptureExecCommand(command)
191191
}
192192
}
193193

194-
func (cs capturers) captureExecStdin(stdin string) {
194+
func (cs capturers) captureExecStdin(stdin string) { //nostyle:recvtype
195195
for _, c := range cs {
196196
c.CaptureExecStdin(stdin)
197197
}
198198
}
199199

200-
func (cs capturers) captureExecStdout(stdout string) {
200+
func (cs capturers) captureExecStdout(stdout string) { //nostyle:recvtype
201201
for _, c := range cs {
202202
c.CaptureExecStdout(stdout)
203203
}
204204
}
205205

206-
func (cs capturers) captureExecStderr(stderr string) {
206+
func (cs capturers) captureExecStderr(stderr string) { //nostyle:recvtype
207207
for _, c := range cs {
208208
c.CaptureExecStderr(stderr)
209209
}
210210
}
211211

212-
func (cs capturers) setCurrentTrails(trs Trails) {
212+
func (cs capturers) setCurrentTrails(trs Trails) { //nostyle:recvtype
213213
for _, c := range cs {
214214
c.SetCurrentTrails(trs)
215215
}

cdpfn.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ func findCDPFn(k string) (string, CDPFn, error) {
333333
return "", CDPFn{}, fmt.Errorf("not found function: %s", k)
334334
}
335335

336-
func (args CDPFnArgs) ArgArgs() CDPFnArgs {
336+
func (args CDPFnArgs) ArgArgs() CDPFnArgs { //nostyle:recvtype
337337
res := CDPFnArgs{}
338338
for _, arg := range args {
339339
if arg.Typ == CDPArgTypeArg {
@@ -343,7 +343,7 @@ func (args CDPFnArgs) ArgArgs() CDPFnArgs {
343343
return res
344344
}
345345

346-
func (args CDPFnArgs) ResArgs() CDPFnArgs {
346+
func (args CDPFnArgs) ResArgs() CDPFnArgs { //nostyle:recvtype
347347
res := CDPFnArgs{}
348348
for _, arg := range args {
349349
if arg.Typ == CDPArgTypeRes {

errors.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ import "fmt"
44

55
type BeforeFuncError struct{ err error }
66

7-
func (e BeforeFuncError) Error() string { return fmt.Errorf("before func error: %w", e.err).Error() }
7+
func (e *BeforeFuncError) Error() string { return fmt.Errorf("before func error: %w", e.err).Error() }
88

9-
func (e BeforeFuncError) Unwrap() error { return e.err }
9+
func (e *BeforeFuncError) Unwrap() error { return e.err }
1010

1111
func newBeforeFuncError(err error) *BeforeFuncError {
1212
return &BeforeFuncError{err: err}
1313
}
1414

1515
type AfterFuncError struct{ err error }
1616

17-
func (e AfterFuncError) Error() string { return fmt.Errorf("after func error: %w", e.err).Error() }
17+
func (e *AfterFuncError) Error() string { return fmt.Errorf("after func error: %w", e.err).Error() }
1818

19-
func (e AfterFuncError) Unwrap() error { return e.err }
19+
func (e *AfterFuncError) Unwrap() error { return e.err }
2020

2121
func newAfterFuncError(err error) *AfterFuncError {
2222
return &AfterFuncError{err: err}

examples/go-test/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func main() {
1212

1313
type HealthCheck struct{}
1414

15-
func (HealthCheck) ServeHTTP(w http.ResponseWriter, r *http.Request) {
15+
func (HealthCheck) ServeHTTP(w http.ResponseWriter, r *http.Request) { //nostyle:recvtype
1616
resp := map[string]string{
1717
"message": "ok",
1818
}

http.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func (r *httpRequest) encodeBody() (io.Reader, error) {
153153
}
154154
}
155155

156-
func (r httpRequest) isMultipartFormDataMediaType() bool {
156+
func (r *httpRequest) isMultipartFormDataMediaType() bool {
157157
if r.mediaType == MediaTypeMultipartFormData {
158158
return true
159159
}

http_validator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (e *UnsupportedError) Error() string {
2929
return e.Cause.Error()
3030
}
3131

32-
func (e UnsupportedError) Unwrap() error {
32+
func (e *UnsupportedError) Unwrap() error {
3333
return e.Cause
3434
}
3535

operator_test.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,9 @@ func TestBeforeFuncErr(t *testing.T) {
770770
t.Fatal(err)
771771
}
772772
if got := o.Run(ctx); got != nil {
773-
if errors.As(got, &BeforeFuncError{}) {
774-
t.Errorf("got %v\nwant %T", got, &BeforeFuncError{})
773+
var be *BeforeFuncError
774+
if errors.Is(got, be) {
775+
t.Errorf("got %v\nwant %T", got, be)
775776
}
776777
return
777778
}
@@ -798,8 +799,9 @@ func TestAfterFuncErr(t *testing.T) {
798799
t.Fatal(err)
799800
}
800801
if got := o.Run(ctx); got != nil {
801-
if errors.As(got, &AfterFuncError{}) {
802-
t.Errorf("got %v\nwant %T", got, &AfterFuncError{})
802+
var ae *AfterFuncError
803+
if errors.Is(got, ae) {
804+
t.Errorf("got %v\nwant %T", got, ae)
803805
}
804806
return
805807
}

trail.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type Trail struct {
4040

4141
type Trails []Trail
4242

43-
func (tr Trail) String() string {
43+
func (tr Trail) String() string { //nostyle:recvtype
4444
switch tr.Type {
4545
case TrailTypeRunbook:
4646
return fmt.Sprintf("runbook[%s]", tr.RunbookPath)
@@ -55,7 +55,7 @@ func (tr Trail) String() string {
5555
}
5656
}
5757

58-
func (trs Trails) toInterfaceSlice() []any {
58+
func (trs Trails) toInterfaceSlice() []any { //nostyle:recvtype
5959
s := make([]any, len(trs))
6060
for i, v := range trs {
6161
s[i] = v

0 commit comments

Comments
 (0)