title: Pointer receiver and Value receiver difference in implementation with Iris framework
body: <p>I am studying Iris framework recently. I encountered a question when I was implementing the Handler. Like following:</p>
  
  <pre class="lang-golang prettyprint-override"><code>package controller
  
  import "github.com/kataras/iris"    
  
  type Pages struct{
  }
  
  func (p *Pages) Serve(c *iris.Context) {
  }
  </code></pre>
  
  <p>In order to use this controller, I implemented the following entry script:</p>
  
  <pre class="lang-golang prettyprint-override"><code>package main
  
  import (
       "github.com/kataras/iris"
       "web/controller"
  )
  
  func main(){
        ctrl := controller.Pages{}
        iris.Handle("GET", "/", ctrl)
        iris.Listen(":8080")
  }
  </code></pre>
  
  <p>But when I compiled the code, I got the following error message:</p>
  
  <pre><code>cannot use ctrl (type controllers.Pages) as type iris.Handler in argument to iris.Handle:
  controllers.Pages does not implement iris.Handler (Serve method has pointer receiver)
  </code></pre>
  
  <p>After I changed the declaration to:</p>
  
  <pre><code>ctrl := &amp;controller.Pages{}
  </code></pre>
  
  <p>Then the compiler passed with no complaint. </p>
  
  <p>The question is: I thought the following statements are equal, since the GO compiler will do the conversion under the table:</p>
  
  <pre class="lang-golang prettyprint-override"><code>type Pages struct {
  }
  
  func (p *Pages) goWithPointer() {
      fmt.Println("goWithPointer")
  }
  
  func (p Pages) goWithValue() {
      fmt.Println("goWithValue")
  }
  
  func main() {
      p1 := Pages{}
      p2 := &amp;Pages{}
  
      p1.goWithPointer()
      p1.goWithValue()
  
      p2.goWithPointer()
      p2.goWithValue()
  }
  </code></pre>
  
  <p>Why can't I use <code>ctrl := controller.Pages{}</code> as the parameter to <code>iris.Handle()</code>, instead of <code>ctrl := &amp;controller.Pages{}</code> as the parameter to <code>iris.Handle()</code>?</p>
  
  <p>Thank you for your time and sharing.</p>