-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace time.Time.String() with time.Time.Format() #1017
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import ( | |
"fmt" | ||
"io" | ||
"strings" | ||
"time" | ||
|
||
jsoniter "github.com/json-iterator/go" | ||
) | ||
|
@@ -76,7 +77,7 @@ func WriteJson(in *Event, writer io.Writer) error { | |
if eventContext.Time != nil { | ||
stream.WriteMore() | ||
stream.WriteObjectField("time") | ||
stream.WriteString(eventContext.Time.String()) | ||
stream.WriteString(eventContext.Time.Format(time.RFC3339Nano)) | ||
} | ||
case *EventContextV1: | ||
// Set a bunch of variables we need later | ||
|
@@ -120,7 +121,7 @@ func WriteJson(in *Event, writer io.Writer) error { | |
if eventContext.Time != nil { | ||
stream.WriteMore() | ||
stream.WriteObjectField("time") | ||
stream.WriteString(eventContext.Time.String()) | ||
stream.WriteString(eventContext.Time.Format(time.RFC3339Nano)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we using Nano here, and the tests don't? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I'm remembering correctly, it was because there were some tests that needed more precision than just "seconds". |
||
} | ||
default: | ||
return fmt.Errorf("missing event context") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why comment out and not remove?