Skip to content

Commit

Permalink
replace defer with t.Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alvii147 authored and maxatome committed Oct 7, 2024
1 parent 6eb813e commit 8705bb3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ populate your `go.mod` with the latest httpmock release, now
```go
func TestFetchArticles(t *testing.T) {
httpmock.Activate()
defer httpmock.DeactivateAndReset()
t.Cleanup(httpmock.DeactivateAndReset)

// Exact URL match
httpmock.RegisterResponder("GET", "https://api.mybiz.com/articles",
Expand Down Expand Up @@ -52,7 +52,7 @@ func TestFetchArticles(t *testing.T) {
```go
func TestFetchArticles(t *testing.T) {
httpmock.Activate()
defer httpmock.DeactivateAndReset()
t.Cleanup(httpmock.DeactivateAndReset)

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

0 comments on commit 8705bb3

Please sign in to comment.