title: Is there any option to use something similar to mockito argument captor?
body: <p>we are using gopkg.in/mgo.v2/bson to talk with mongo, and its API populates passed structures instead returning results, for example:</p>
  
  <pre><code>func (p *Pipe) One(result interface{}) error {...
  </code></pre>
  
  <p>Problems occurs when I want to mock / test code which is using that. I want to both mock this execution and somehow get pupulated value in 'result'.
  Currently test has:</p>
  
  <pre><code>query.EXPECT().One(gomock.Any())
  </code></pre>
  
  <p>So as you can see I dont get any value, I just configure gomock to check that when I run my method then query.One has to be called.
  I cannot pass structure like </p>
  
  <pre><code>mystruct := MyStruct{}
  query.EXPECT().One(&amp;mystruct)
  </code></pre>
  
  <p>because mystruct in test code and in real code is different and verifing mock will fail (references are different). Im looking for something similar to mockito's argument captor:
  <a href="https://static.javadoc.io/org.mockito/mockito-core/2.6.9/org/mockito/ArgumentCaptor.html" rel="nofollow noreferrer">https://static.javadoc.io/org.mockito/mockito-core/2.6.9/org/mockito/ArgumentCaptor.html</a></p>