title: Why does code inside unused method run?
body: <p>The code below comes from Todd Mcleod's Golang web-dev course. What I fail to understand - even watching his video's over and over and googling everything about methods- is the following: <strong>The method ServeHTTP is attached to type hotdog, but is never ran. Still the code inside the method (in this case Fprintln(...) is executed.</strong> (When you run this code and go to localhost:8080, it diesplays "Any code you want in this func".) Could anyone explain me why this is?</p>
  
  <p>Thanks a lot! </p>
  
  <pre><code>package main
  
  import (
      "fmt"
       "net/http"
  )
  
  type hotdog int
  
   func (m hotdog) ServeHTTP(w http.ResponseWriter, r *http.Request) {
       fmt.Fprintln(w, "Any code you want in this func")
  }
  
   func main() {
      var d hotdog
      http.ListenAndServe(":8080", d)
  }
  </code></pre>