File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -72,15 +72,15 @@ type Comment struct {
7272 Body string `json:"body"`
7373}
7474
75- // setDefaults sets the createdAt and lastEdtedAt values to time.Now() if they are otherwise unset
75+ // setDefaults sets the createdAt value to time.Now(), and the lastEditedAt value to zero, if they are otherwise unset
7676func (c * Comment ) setDefaults () {
7777 now := time .Now ()
7878 if c .CreatedAt == nil {
7979 c .CreatedAt = & now
8080 }
8181
8282 if c .LastEditedAt == nil {
83- c .LastEditedAt = & now
83+ c .LastEditedAt = & time. Time {}
8484 }
8585}
8686
@@ -112,7 +112,7 @@ func (r *Review) setDefaults(id, sha string) {
112112 }
113113
114114 if r .LastEditedAt == nil {
115- r .LastEditedAt = & now
115+ r .LastEditedAt = & time. Time {}
116116 }
117117
118118 r .ID = id
Original file line number Diff line number Diff line change @@ -82,11 +82,11 @@ func TestOptionDefaults(t *testing.T) {
8282 options .setDefaults ()
8383 for _ , comment := range options .AddComments {
8484 assert .False (t , comment .CreatedAt .IsZero ())
85- assert .False (t , comment .LastEditedAt .IsZero ())
85+ assert .True (t , comment .LastEditedAt .IsZero ())
8686 }
8787
8888 for _ , review := range options .AddReviews {
8989 assert .False (t , review .CreatedAt .IsZero ())
90- assert .False (t , review .LastEditedAt .IsZero ())
90+ assert .True (t , review .LastEditedAt .IsZero ())
9191 }
9292}
You can’t perform that action at this time.
0 commit comments