diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2021-08-25 09:47:53 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2021-08-25 10:29:46 +0300 |
commit | ac23f02465369644c7d835a667e2c034fc629c37 (patch) | |
tree | 0fc3a82f45272a5b69f07f4b327c741091a20f94 | |
parent | 135c1398b2531103d3aeebaee66f19ef799f1f52 (diff) |
chore: replace ioutil.WriteFile with os
-rw-r--r-- | internal/redirects/redirects_benchmark_test.go | 3 | ||||
-rw-r--r-- | internal/redirects/redirects_test.go | 5 |
2 files changed, 3 insertions, 5 deletions
diff --git a/internal/redirects/redirects_benchmark_test.go b/internal/redirects/redirects_benchmark_test.go index 87452172..be86eb0c 100644 --- a/internal/redirects/redirects_benchmark_test.go +++ b/internal/redirects/redirects_benchmark_test.go @@ -2,7 +2,6 @@ package redirects import ( "context" - "io/ioutil" "net/url" "path" "strings" @@ -24,7 +23,7 @@ func generateRedirectsFile(dirPath string, count int) error { content += "/entrance.html /exit.html 301\n" - return ioutil.WriteFile(path.Join(dirPath, ConfigFile), []byte(content), 0600) + return os.WriteFile(path.Join(dirPath, ConfigFile), []byte(content), 0600) } func benchmarkRedirectsRewrite(b *testing.B, redirectsCount int) { diff --git a/internal/redirects/redirects_test.go b/internal/redirects/redirects_test.go index 2fe0034a..118b99a5 100644 --- a/internal/redirects/redirects_test.go +++ b/internal/redirects/redirects_test.go @@ -2,7 +2,6 @@ package redirects import ( "context" - "io/ioutil" "net/url" "os" "path" @@ -205,7 +204,7 @@ func TestRedirectsParseRedirects(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if tt.redirectsFile != "" { - err := ioutil.WriteFile(path.Join(tmpDir, ConfigFile), []byte(tt.redirectsFile), 0600) + err := os.WriteFile(path.Join(tmpDir, ConfigFile), []byte(tt.redirectsFile), 0600) require.NoError(t, err) } @@ -225,7 +224,7 @@ func TestRedirectsParseRedirects(t *testing.T) { func TestMaxRuleCount(t *testing.T) { root, tmpDir := testhelpers.TmpDir(t, "TooManyRules_tests") - err := ioutil.WriteFile(path.Join(tmpDir, ConfigFile), []byte(strings.Repeat("/goto.html /target.html 301\n", maxRuleCount-1)+ + err := os.WriteFile(path.Join(tmpDir, ConfigFile), []byte(strings.Repeat("/goto.html /target.html 301\n", maxRuleCount-1)+ "/1000.html /target1000 301\n"+ "/1001.html /target1001 301\n", ), 0600) |