title: golang pointers on pointers as function parameters
body: <p>I have the following function: </p>
  
  <pre><code>func addCatsToMap(m map[string][]CatHouse, meowId int, treats Set, dog *Dog) {
  
  //if (complicated thing) add Cat to m
  
  }
  </code></pre>
  
  <p>where <code>Set</code>, the type of <code>treats</code>, is an interface with the following definition:</p>
  
  <pre><code>type Set interface {
    Add(value string)
    Contains(value string) (bool)
    Length() (int)
    RemoveDuplicates()
  }
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>Is it true that <code>m</code>, <code>treats</code>, and <code>dog</code> are <em>passed-by-reference</em>, and <code>meowId</code> has it's value copied?</p>
  
  <p>I assume that:</p>
  
  <ul>
  <li><code>m</code> is pass-by-reference because it's a map</li>
  <li><code>dog</code> is a struct. So, I should pass the pointer to avoid copying the data</li>
  </ul>