title: "Static" method design
body: <p>I'm looking for advice on the best way to clean up the following structure. I know Go doesn't have static methods and it's usually <a href="https://groups.google.com/d/topic/golang-nuts/mKXyUoVT6m4" rel="nofollow noreferrer">better to encapsulate functionality in a separate package</a>. My struct types reference each other, and so cannot be declared in separate packages because of circular imports.</p>
  <pre><code>type Payment struct {
      User *User
  }
  
  type User struct {
      Payments *[]Payments
  }
  
  func (u *User) Get(id int) *User {
      // Returns the user with the given id 
  }
  
  func (p *Payment) Get(id int) *Payment {
      // Returns the payment with the given id 
  }
  </code></pre>
  <p>But, if I want to load a user or payment, I'm just throwing away the receiver:</p>
  <pre><code>var u *User
  user := u.Get(585)
  </code></pre>
  <p>I could namespace the functions themselves, which strikes me as unclean:</p>
  <pre><code>func GetUser(id int) *User {
      // Returns the user with the given id 
  }
  
  func GetPayment(id int) *Payment {
      // Returns the payment with the given id 
  }
  </code></pre>
  <p>I would really like to be able to just call <code>.Get</code> or similar on the struct without writing the name of the struct in the function itself. What's the idiomatic way to do this?</p>