title: Golang methods with same name and arity, but different type
body: <p>The following code works fine. Two methods operating on two different structs and printing a field of the struct:</p>
  <pre><code>type A struct {
    Name string
  }
  
  type B struct {
    Name string
  }
  
  func (a *A) Print() {
    fmt.Println(a.Name)
  }
  
  func (b *B) Print() {
    fmt.Println(b.Name)
  }
  
  func main() {
  
    a := &amp;A{&quot;A&quot;}
    b := &amp;B{&quot;B&quot;}
  
    a.Print()
    b.Print()
  }
  </code></pre>
  <p>Shows the desired output in the console:</p>
  <pre><code>A
  B
  </code></pre>
  <p><em>Now</em>, if I change the method signature in the following way I get an compile error. I just move the receiver of the method to the arguments of the method:</p>
  <pre><code>func Print(a *A) {
    fmt.Println(a.Name)
  }
  
  func Print(b *B) {
    fmt.Println(b.Name)
  }
  
  func main() {
  
    a := &amp;A{&quot;A&quot;}
    b := &amp;B{&quot;B&quot;}
  
    Print(a)
    Print(b)
  }
  </code></pre>
  <p>I can't even compile the program:</p>
  <pre><code>./test.go:22: Print redeclared in this block
      previous declaration at ./test.go:18
  ./test.go:40: cannot use a (type *A) as type *B in function argument
  </code></pre>
  <p>Why is it that I can interchange struct types in the receiver, but not in the
  arguments, when the methods have the same name and arity?</p>