Skip to content

Commit 8705bb3

Browse files
alvii147maxatome
authored andcommitted
replace defer with t.Cleanup
1 parent 6eb813e commit 8705bb3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ populate your `go.mod` with the latest httpmock release, now
2424
```go
2525
func TestFetchArticles(t *testing.T) {
2626
httpmock.Activate()
27-
defer httpmock.DeactivateAndReset()
27+
t.Cleanup(httpmock.DeactivateAndReset)
2828

2929
// Exact URL match
3030
httpmock.RegisterResponder("GET", "https://api.mybiz.com/articles",
@@ -52,7 +52,7 @@ func TestFetchArticles(t *testing.T) {
5252
```go
5353
func TestFetchArticles(t *testing.T) {
5454
httpmock.Activate()
55-
defer httpmock.DeactivateAndReset()
55+
t.Cleanup(httpmock.DeactivateAndReset)
5656

5757
// our database of articles
5858
articles := make([]map[string]interface{}, 0)

0 commit comments

Comments
 (0)