title: Golang switch between structs
body: <p>I'm new to golang and I'm trying to create a function that, based on the struct it's used on, will return a formatted string using Sprintf</p>
  
  <pre><code>type Name struct {
      Title string
      First string
      Last  string
  }
  
  type Location struct {
      Street string
      City   string
      State  string
      Zip    string
  }
  
  func Merge(m interface{}) string {
      switch m.(type) {
      case *Location:
          return fmt.Sprintf("%s \n %s, %s %s", m.(*Location).Street, m.(*Location).City, m.(*Location).State, m.(*Location).Zip)
      case *Name:
          return fmt.Sprintf("%s. %s %s", m.(*Name).Title, m.(*Name).First, m.(*Name).Last)
      }
      return "Not Applicable"
  }
  
  fmt.Println(Merge(Location))
  </code></pre>
  
  <p>I'm getting the "<code>Not Applicable</code>" message from my <code>PrintLn</code>. In one version of the code, I believe the message was "<code>out of index</code>". </p>