title: method ambiguity when declaring a type in Go
body: <p>I'm learning go and came across this piece of code on go tour:</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "math"
  )
  
  type MyFloat int
  
  func (f MyFloat) Abs() float64 {
      if f &lt; 0 {
          return float64(-f)
      }
      return float64(f)
  }
  
  func (f MyFloat) run() string{
      fmt.Println("This is called")
      return "Hey there"
      }
  
  func main() {
      f := MyFloat(-math.Sqrt2)
      fmt.Println(f.Abs())
      fmt.Println(f.run())
  }
  </code></pre>
  
  <p>Here we declare a type named MyFloat and return type is float64. I was thinking that I can declare methods which only returns float64. I declared a method named <code>run()</code> in the above case which returns string. How is this possible? Why can't I just declare the type with no specific return type like this <code>type MyFloat</code>?</p>
  
  <p><a href="https://play.golang.org/p/K33MHexzlL" rel="nofollow noreferrer">Example in Playground</a></p>