Time field error

I have problem about time field struct as below

type Mys struct{
  CreatedAt time.Time

m = Mys{ CreatedAt: time.Now}

error message

cannot use time.Now (type func() time.Time) as type time.Time in field value

1 Like

Hey @drafdev,

I think you mean to use time.Now(). At the moment you aren’t calling the function.

m = Mys{CreatedAt: time.Now()}

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.