Skip to content

Commit

Permalink
refactor: refactor testing functions in zap_test file
Browse files Browse the repository at this point in the history
- Change the `timestampLocationCheck` function signature to remove the `*testing.T` parameter
- Update calls to `timestampLocationCheck` to match the new function signature in `zap_test.go`

Signed-off-by: appleboy <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed Mar 2, 2024
1 parent d4400a8 commit a9803c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions zap_test.go
Expand Up @@ -24,7 +24,7 @@ func buildDummyLogger() (*zap.Logger, *observer.ObservedLogs) {
return logger, obs
}

func timestampLocationCheck(t *testing.T, timestampStr string, location *time.Location) error {
func timestampLocationCheck(timestampStr string, location *time.Location) error {
timestamp, err := time.Parse(time.RFC3339, timestampStr)
if err != nil {
return err
Expand Down Expand Up @@ -63,7 +63,7 @@ func TestGinzap(t *testing.T) {
t.Fatalf("logged path should be /test but %s", pathStr)
}

err := timestampLocationCheck(t, logLine.Context[7].String, time.UTC)
err := timestampLocationCheck(logLine.Context[7].String, time.UTC)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -120,7 +120,7 @@ func TestGinzapWithConfig(t *testing.T) {
t.Fatalf("logged path should be /test but %s", pathStr)
}

err := timestampLocationCheck(t, logLine.Context[7].String, time.UTC)
err := timestampLocationCheck(logLine.Context[7].String, time.UTC)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit a9803c5

Please sign in to comment.