MCPcopy Create free account
hub / github.com/google/git-appraise / serialize

Method serialize

review/comment/comment.go:163–176  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

161}
162
163func (comment Comment) serialize() ([]byte, error) {
164 if len(comment.Timestamp) < 10 {
165 // To make sure that timestamps from before 2001 appear in the correct
166 // alphabetical order, we reformat the timestamp to be at least 10 characters
167 // and zero-padded.
168 time, err := strconv.ParseInt(comment.Timestamp, 10, 64)
169 if err == nil {
170 comment.Timestamp = fmt.Sprintf("%010d", time)
171 }
172 // We ignore the other case, as the comment timestamp is not in a format
173 // we expected, so we should just leave it alone.
174 }
175 return json.Marshal(comment)
176}
177
178// Write writes a review comment as a JSON-formatted git note.
179func (comment Comment) Write() (repository.Note, error) {

Callers 2

WriteMethod · 0.95
HashMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected