title: golang set value on time.Time
body: <pre><code>package main
  
  import (
      "fmt"
      "reflect"
  )
  
  func main() {
      type t struct {
          N int
      }
      var n = t{42}
      fmt.Println(n.N)
      reflect.ValueOf(&amp;n).Elem().FieldByName("N").SetInt(7)
      fmt.Println(n.N)
  }
  </code></pre>
  
  <p>The prog below works the question is how do I do this with time.Time type like</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "reflect"
      "time"
  )
  
  func main() {
      type t struct {
          N time.Time
      }
      var n = t{ time.Now() }
      fmt.Println(n.N)
      reflect.ValueOf(&amp;n).Elem().FieldByName("N"). (what func)   (SetInt(7) is only for int)         // there is not SetTime
      fmt.Println(n.N)
  }
  </code></pre>
  
  <p>This is important because I plan to use it on generic struct  </p>
  
  <p>I really appreciate your help on this</p>