title: Private fields and methods for a struct
body: <p>In the following test code I would like to have both <code>mytype</code> and the <code>doPrivate</code> method private, so that only members of <code>mytype</code> can access it, but not other types\functions in the scope of the <code>mypackage</code> package.</p>
  
  <p>Can I do this in golang?</p>
  
  <pre><code>package mypackage
  
  type mytype struct {
      size          string
      hash          uint32
  }
  
  func (r *mytype) doPrivate() string {
      return r.size
  }
  
  func (r *mytype) Do() string {
      return doPrivate("dsdsd")
  }
  </code></pre>
  
  <p>Fields <code>size</code> and <code>hash</code> as well as the <code>doPrivate</code> method should be encapsulated and no other type should have access to them. </p>