title: Why Go reflect NumField() is only available on the type?
body: <p>I have the following Go code (<a href="https://play.golang.org/p/mOyRM-QDvT7" rel="nofollow noreferrer">play.golang.org</a>):</p>
  
  <pre><code>package main
  
  import (
      "reflect"
      "fmt"
  )
  
  type User struct {
      name string
      email string
  }
  
  func main() {   
      uS := User{}
      uSt := reflect.TypeOf(uS)   
  
      fmt.Println( uSt )
      fmt.Println( uSt.NumField() )
      // fmt.Println( uS.NumField() ) // this doesn't work, why?
  
  }
  </code></pre>
  
  <p>I'm just curious here. Why we need to get the type of the struct first before calling <code>NumField()</code>?</p>
  
  <p>Why can't we just call it on the struct itself i.e. <code>uS.NumField()</code>?</p>
  
  <p>From <a href="https://golang.org/pkg/reflect/#Value" rel="nofollow noreferrer">docs</a>:</p>
  
  <pre><code>type Value struct {
          // contains filtered or unexported fields
  }
  
  func (v Value) NumField() int
  </code></pre>
  
  <p>I'm not quite getting what is <code>Value</code> really means here. I do really appreciate concise explanation and examples.</p>