good morning!!!!

Skip to content
Snippets Groups Projects
Commit 61bf29be authored by Taylor Gerring's avatar Taylor Gerring
Browse files

Check length of timestring before taking slice

parent 58909117
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,12 @@ import (
type utctime8601 struct{}
func (utctime8601) MarshalJSON() ([]byte, error) {
return []byte(`"` + time.Now().UTC().Format(time.RFC3339Nano)[:26] + `Z"`), nil
timestr := time.Now().UTC().Format(time.RFC3339Nano)
// Bounds check
if len(timestr) > 26 {
timestr = timestr[:26]
}
return []byte(`"` + timestr + `Z"`), nil
}
type JsonLog interface {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment