Skip to content

Commit 4bd8626

Browse files
committed
chore: update to v0.3.3
1 parent 873220c commit 4bd8626

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ require (
100100
github.com/shirou/gopsutil/v4 v4.25.3
101101
github.com/sirupsen/logrus v1.9.3
102102
github.com/sivchari/containedctx v1.0.3
103-
github.com/sonatard/noctx v0.3.2
103+
github.com/sonatard/noctx v0.3.3
104104
github.com/sourcegraph/go-diff v0.7.0
105105
github.com/spf13/cobra v1.9.1
106106
github.com/spf13/pflag v1.0.6

go.sum

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/golinters/noctx/testdata/noctx.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func _() {
2323
cli.Do(req2)
2424

2525
req3, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
26-
req3 = req3.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
26+
req3 = req3.WithContext(ctx)
2727
cli.Do(req3)
2828

2929
f2 := func(req *http.Request, ctx context.Context) *http.Request {
@@ -33,15 +33,15 @@ func _() {
3333
req4 = f2(req4, ctx)
3434

3535
req41, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
36-
req41 = req41.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
36+
req41 = req41.WithContext(ctx)
3737
req41 = f2(req41, ctx)
3838

3939
newRequest := http.NewRequest
4040
req5, _ := newRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
4141
cli.Do(req5)
4242

4343
req51, _ := newRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
44-
req51 = req51.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
44+
req51 = req51.WithContext(ctx)
4545
cli.Do(req51)
4646

4747
req52, _ := newRequestPkg(http.MethodPost, url, nil) // TODO: false negative `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
@@ -55,7 +55,7 @@ func _() {
5555
req6 = f3(req6, ctx)
5656

5757
req61, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
58-
req61 = req61.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
58+
req61 = req61.WithContext(ctx)
5959
req61 = f3(req61, ctx)
6060

6161
type MyRequest2 http.Request
@@ -67,7 +67,7 @@ func _() {
6767
f4(&req71, ctx)
6868

6969
req72, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
70-
req72 = req72.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
70+
req72 = req72.WithContext(ctx)
7171
req73 := MyRequest2(*req7)
7272
f4(&req73, ctx)
7373

@@ -78,7 +78,7 @@ func _() {
7878

7979
req82, _ := func() (*http.Request, error) {
8080
req82, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
81-
req82 = req82.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
81+
req82 = req82.WithContext(ctx)
8282
return req82, nil
8383
}()
8484
cli.Do(req82)
@@ -90,7 +90,7 @@ func _() {
9090
req9, _ = f5(req9, req9, ctx)
9191

9292
req91, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
93-
req91 = req91.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
93+
req91 = req91.WithContext(ctx)
9494
req9, _ = f5(req91, req91, ctx)
9595

9696
req10, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
@@ -99,7 +99,7 @@ func _() {
9999

100100
req101, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
101101
req111, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
102-
req111 = req111.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
102+
req111 = req111.WithContext(ctx)
103103
req101, req111 = f5(req101, req111, ctx)
104104

105105
func() (*http.Request, *http.Request) {
@@ -111,14 +111,14 @@ func _() {
111111
func() (*http.Request, *http.Request) {
112112
req14, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
113113
req15, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
114-
req15 = req15.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
114+
req15 = req15.WithContext(ctx)
115115

116116
return req14, req15
117117
}()
118118

119119
req121, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
120120
req121.AddCookie(&http.Cookie{Name: "k", Value: "v"})
121-
req121 = req121.WithContext(context.WithValue(req121.Context(), struct{}{}, 0)) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
121+
req121 = req121.WithContext(context.WithValue(req121.Context(), struct{}{}, 0))
122122
cli.Do(req121)
123123
}
124124

pkg/golinters/noctx/testdata/noctx_cgo.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func _() {
4040
cli.Do(req2)
4141

4242
req3, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
43-
req3 = req3.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
43+
req3 = req3.WithContext(ctx)
4444
cli.Do(req3)
4545

4646
f2 := func(req *http.Request, ctx context.Context) *http.Request {
@@ -50,15 +50,15 @@ func _() {
5050
req4 = f2(req4, ctx)
5151

5252
req41, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
53-
req41 = req41.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
53+
req41 = req41.WithContext(ctx)
5454
req41 = f2(req41, ctx)
5555

5656
newRequest := http.NewRequest
5757
req5, _ := newRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
5858
cli.Do(req5)
5959

6060
req51, _ := newRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
61-
req51 = req51.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
61+
req51 = req51.WithContext(ctx)
6262
cli.Do(req51)
6363

6464
req52, _ := newRequestPkg(http.MethodPost, url, nil) // TODO: false negative `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
@@ -72,7 +72,7 @@ func _() {
7272
req6 = f3(req6, ctx)
7373

7474
req61, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
75-
req61 = req61.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
75+
req61 = req61.WithContext(ctx)
7676
req61 = f3(req61, ctx)
7777

7878
type MyRequest2 http.Request
@@ -84,7 +84,7 @@ func _() {
8484
f4(&req71, ctx)
8585

8686
req72, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
87-
req72 = req72.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
87+
req72 = req72.WithContext(ctx)
8888
req73 := MyRequest2(*req7)
8989
f4(&req73, ctx)
9090

@@ -95,7 +95,7 @@ func _() {
9595

9696
req82, _ := func() (*http.Request, error) {
9797
req82, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
98-
req82 = req82.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
98+
req82 = req82.WithContext(ctx)
9999
return req82, nil
100100
}()
101101
cli.Do(req82)
@@ -107,7 +107,7 @@ func _() {
107107
req9, _ = f5(req9, req9, ctx)
108108

109109
req91, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
110-
req91 = req91.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
110+
req91 = req91.WithContext(ctx)
111111
req9, _ = f5(req91, req91, ctx)
112112

113113
req10, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
@@ -116,7 +116,7 @@ func _() {
116116

117117
req101, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
118118
req111, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
119-
req111 = req111.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
119+
req111 = req111.WithContext(ctx)
120120
req101, req111 = f5(req101, req111, ctx)
121121

122122
func() (*http.Request, *http.Request) {
@@ -128,14 +128,14 @@ func _() {
128128
func() (*http.Request, *http.Request) {
129129
req14, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
130130
req15, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
131-
req15 = req15.WithContext(ctx) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
131+
req15 = req15.WithContext(ctx)
132132

133133
return req14, req15
134134
}()
135135

136136
req121, _ := http.NewRequest(http.MethodPost, url, nil) // want `net/http\.NewRequest must not be called. use net/http\.NewRequestWithContext`
137137
req121.AddCookie(&http.Cookie{Name: "k", Value: "v"})
138-
req121 = req121.WithContext(context.WithValue(req121.Context(), struct{}{}, 0)) // want `\(\*net/http\.Request\)\.WithContext must not be called. use net/http\.NewRequestWithContext`
138+
req121 = req121.WithContext(context.WithValue(req121.Context(), struct{}{}, 0))
139139
cli.Do(req121)
140140
}
141141

0 commit comments

Comments
 (0)