From 6e6360c0c7db235902fcec84427e4bb43bf9f9af Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 17 Feb 2024 16:37:27 +0800 Subject: [PATCH] test: refactor tests and cleanup imports - Replace `ioutil.TempFile` with `os.CreateTemp` in `TestEmptyDirectory` test function - Remove unused import `io/ioutil` in `serve_test.go` Signed-off-by: Bo-Yi Wu --- serve_test.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/serve_test.go b/serve_test.go index 685cc65..f3e4a33 100644 --- a/serve_test.go +++ b/serve_test.go @@ -2,7 +2,6 @@ package static import ( "context" - "io/ioutil" "net/http" "net/http/httptest" "os" @@ -23,9 +22,8 @@ func PerformRequest(r http.Handler, method, path string) *httptest.ResponseRecor } func TestEmptyDirectory(t *testing.T) { - // SETUP file testRoot, _ := os.Getwd() - f, err := ioutil.TempFile(testRoot, "") + f, err := os.CreateTemp(testRoot, "") if err != nil { t.Error(err) }