title: Using mockgen in reflect mode
body: <p>I am trying to write some tests for an existing library but cannot get gomock to work</p>
  
  <p>I would like to test behaviour if rand.Read fails.  Here is an example of what I would like to test.  I would like to see the log.Error line executing in test </p>
  
  <pre><code>import (
       "crypto/rand"
  )
      func GetRandomBytes(n int) ([]byte, error) {
  
          b := make([]byte, n)
          _, err := rand.Read(b)
  
          if err != nil {
              log.Error("Failed to get entropy from system", err)
              return nil, err
          }
  
          return b, nil
      }
  </code></pre>
  
  <p>The gomock system should let me force the "rand.Read" call to do the right thing</p>
  
  <p>However, I cannot get the mockgen tool to work in "reflect" mode</p>
  
  <pre><code>$ $GOPATH/bin/mockgen 'crypto/rand' Read
  # command-line-arguments
  ./prog.go:22:28: invalid indirect of "crypto/rand".Read (type func([]byte) (int, error))
  2018/01/21 11:20:30 Loading input failed: exit status 2
  </code></pre>
  
  <p>I'm using 
  go version go1.9.2 linux/amd64 on Ubuntu 14.04</p>
  
  <p><code>genmock -prog_only 'crypto/rand' Read</code>   works fine, but the code it generates doesn't look useful for what I need to do</p>