title: Monkey Patching in Go show different result when running from CLI
body: <p>I am using Monkey Patching in Go. When I debug the following code in VSCode it shows that the function proc.Signal return the error programmed.</p>
  <pre><code>func TestCheckProcessRunning(t *testing.T) {
      monkey.Patch((*os.Process).Signal, func(p *os.Process, sig os.Signal) error {
          return errors.New(&quot;Signal failed&quot;)
      })
      proc := &amp;os.Process{}
      sig_e := proc.Signal(syscall.Signal(0))
      fmt.Printf(&quot;%s\n&quot;, sig_e)
  
  }
  </code></pre>
  <pre><code>Signal failed
  </code></pre>
  <p>But when I tried to run the test using <strong>go test .</strong> , the patch is no longer applied and got a different error:</p>
  <pre><code>os: process not initialized 
  </code></pre>
  <p>Any idea of what I am doing wrong?</p>