title: "method requires pointer receiver" in Go Programming Language
body: <p>I just saw a presentation of the Go programming language and thought I'd try to write a few lines. Everything worked fine until I tried to use an interface in this situation. How do I solve this?</p>
  
  <pre><code>package main
  
  import "fmt"
  
  type entity float32
  
  func (e *entity) inc() {
      *e++
  }
  
  type incer interface {
      inc()
  }
  
  func doSomething(i incer) {
      i.inc()
  }
  
  func main() {
      fmt.Println("Hello, 世界")
  
      var e entity = 3
      e.inc()
      doSomething(e)
      fmt.Println(e)
  }
  </code></pre>
  
  <p>I get the compiler error:</p>
  
  <pre><code>prog.go:24: cannot use e (type entity) as type incer in function argument:
  entity does not implement incer (inc method requires pointer receiver)
  </code></pre>
  
  <p>I want to use a pointer so that the inc() will affect the enity outside the function. What is the syntax I should use?</p>
  
  <p>/Ricky</p>