title: What's the difference between v.Type().Elem() & v.Elem().Type()?
body: <p>In the following code, both options seem to allocate the same resource</p>
  
  <pre><code>func Allocate(v interface{}) error {
      rv := reflect.ValueOf(v)
      if rv.IsNil() {
          return errors.New("Value of v is nil")
      }
      s0 := reflect.New(rv.Type().Elem())
      s1 := reflect.New(rv.Elem().Type())
  
      return errors.New(fmt.Sprintf("What's the diff? %v %v", s0, s1))
  }
  </code></pre>
  
  <p>If there's no difference in this specific example, an example illustrating the difference will be great. Also what's the preferable option in this specific case when trying to allocate for an interface.</p>
  
  <p>Edit: reflect.DeepEqual(s0, s1) returns false. I think rv.Elem().Type() has a problem dealing with zero values so maybe rv.Type().Elem() is preferred. </p>
  
  <p><a href="https://play.golang.org/p/8HydwIfgP3" rel="nofollow">Playground</a></p>