title: Switch case on interface type
body: <p>I'm trying to identify a type that implements an interface using a <code>switch</code>:</p>
  
  <pre><code>package main    
  
  import "fmt"
  
  
  type Abser interface {
      Abs() float64
  }
  
  type Vertex struct {
      X, Y int
  }
  
  func (v *Vertex) Abs() float64 {
      return float64(v.X)
  }
  
  func do(i interface{}) {
      switch v := i.(type) {
      case Abser:
          fmt.Println("theres an Abser")
      case Vertex:
          fmt.Println("theres a Vertex")
      default:
          fmt.Printf("I don't know about type %T!\n", v)
      }
  }
  
  func main() {
      do(Vertex{1,2})
  }
  </code></pre>
  
  <p>This code outputs the value for <code>Vertex</code> instead of <code>Abser</code>. Ideally it should have output <code>theres an Abser</code> since Vertex implements the <code>Abs()</code> method. Is it possible to use a switch-case to do this?</p>