From e3221e7a7a44900483978af65d4c4c9f9e4e397f Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 17 Feb 2024 16:26:13 +0800 Subject: [PATCH] test: improve reliability of file operations - Add error handling after writing to a file in `local_file_test.go` test function Signed-off-by: Bo-Yi Wu --- local_file_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/local_file_test.go b/local_file_test.go index 0ab922a..7718d2d 100644 --- a/local_file_test.go +++ b/local_file_test.go @@ -18,7 +18,10 @@ func TestLocalFile(t *testing.T) { t.Error(err) } defer os.Remove(f.Name()) - f.WriteString("Gin Web Framework") + _, err = f.WriteString("Gin Web Framework") + if err != nil { + t.Error(err) + } f.Close() dir, filename := filepath.Split(f.Name())