title: How do I declare a composite interface in Go?
body: <p>The following interface defines a set of methods to be implemented by mooing objects:</p>
  
  <pre><code>type Mooing interface {
      Moo() string
  }
  </code></pre>
  
  <p>The following defines a set of methods to be implemented by grazing objects:</p>
  
  <pre><code>type Grazing interface {
      EatGrass()
  }
  </code></pre>
  
  <p>I have a function that operates on cows:</p>
  
  <pre><code>func Milk(cow *Cow)
  </code></pre>
  
  <p>It doesn't have to be a cow, though--anything that conforms to <code>Mooing</code> and <code>Grazing</code> is close enough. In Go, is it possible to specify a parameter of <code>Mooing and Grazing</code>? In pseudocode, something like the following?</p>
  
  <pre><code>func Milk(cow {Mooing, Grazing})
  </code></pre>
  
  <p>In other words, only parameters that satisfy both of these interfaces will be accepted.</p>