Skip to content

Commit c19022f

Browse files
committed
refactor: standardize error creation in test files
- Import the errors package for error creation in tests - Replace usage of fmt.Errorf with errors.New for creating a custom error in the test Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
1 parent df71c1c commit c19022f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

logger_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package logger
33
import (
44
"bytes"
55
"context"
6+
"errors"
67
"fmt"
78
"net/http"
89
"net/http/httptest"
@@ -333,7 +334,7 @@ func TestLoggerCustomMessageWithErrors(t *testing.T) {
333334
WithMessage("Custom message"),
334335
))
335336
r.GET("/example", func(c *gin.Context) {
336-
c.Error(fmt.Errorf("custom error"))
337+
_ = c.Error(errors.New("custom error"))
337338
})
338339

339340
performRequest(r, "GET", "/example")

0 commit comments

Comments
 (0)