From 72f0730f65051a0ea3ff45e49bd101e282bfcf88 Mon Sep 17 00:00:00 2001 From: alvii147 Date: Sun, 6 Oct 2024 13:25:42 -0400 Subject: [PATCH] replace defer with t.Cleanup --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ff3f28c..c436329 100644 --- a/README.md +++ b/README.md @@ -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", @@ -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)