<p dir="auto">1: go version go1.5.1 darwin/amd64<br>
2: OSX 10.11 MacPro6,1Quad-Core Intel Xeon E5<br>
3: Minimal program to create an invalid go binary on OSX using codesign tool.</p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package main

import &quot;C&quot; // Delete this line and codesign'd binary works.

func main() {
    println(&quot;Hello OSX.&quot;)
}"><pre class="notranslate"><span class="pl-k">package</span> main

<span class="pl-k">import</span> <span class="pl-s">"C"</span> <span class="pl-c">// Delete this line and codesign'd binary works.</span>

<span class="pl-k">func</span> <span class="pl-en">main</span>() {
    <span class="pl-en">println</span>(<span class="pl-s">"Hello OSX."</span>)
}</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="~/code/src/ttt: go build
~/code/src/ttt: ./ttt
Hello OSX.
~/code/src/ttt: codesign -s &quot;Developer ID Application: Name&quot; ttt
~/code/src/ttt: ./ttt
Killed: 9"><pre class="notranslate"><code class="notranslate">~/code/src/ttt: go build
~/code/src/ttt: ./ttt
Hello OSX.
~/code/src/ttt: codesign -s "Developer ID Application: Name" ttt
~/code/src/ttt: ./ttt
Killed: 9
</code></pre></div>
<p dir="auto">4: The program should run successfully after code signing. This used to work prior to OSX 10.11.<br>
5: All of my OSX Go products depend on Cgo. Still looking for a workaround.<br>
Possibly related to issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="107376837" data-permission-text="Title is private" data-url="https://github.com/golang/go/issues/12700" data-hovercard-type="issue" data-hovercard-url="/golang/go/issues/12700/hovercard" href="https://github.com/golang/go/issues/12700">#12700</a></p>
<p dir="auto">Using the Go 1.5 compiler toolchain and compiling a binary that uses CGO and then <code class="notranslate">codesign</code>ing that binary, upon attempting to execute the program it will be killed immediately by the system. Codesigning a non-cgo binary works just fine, as expected.</p>
<p dir="auto">Given the following small program:</p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package main

/*
int
cfunc() {
    return 2;
}
*/
import &quot;C&quot;
import &quot;fmt&quot;

func main() {
    fmt.Println(&quot;cfunc says:&quot;, C.cfunc())
}"><pre class="notranslate"><span class="pl-k">package</span> main

<span class="pl-c">/*</span>
<span class="pl-c">int</span>
<span class="pl-c">cfunc() {</span>
<span class="pl-c">    return 2;</span>
<span class="pl-c">}</span>
<span class="pl-c">*/</span>
<span class="pl-k">import</span> <span class="pl-s">"C"</span>
<span class="pl-k">import</span> <span class="pl-s">"fmt"</span>

<span class="pl-k">func</span> <span class="pl-en">main</span>() {
    <span class="pl-s1">fmt</span>.<span class="pl-en">Println</span>(<span class="pl-s">"cfunc says:"</span>, <span class="pl-s1">C</span>.<span class="pl-en">cfunc</span>())
}</pre></div>
<p dir="auto">and building simply with <code class="notranslate">go build</code> and running <code class="notranslate">codesign -f -s my_cert ./myprog</code>, when attempting to execute the program in a shell the response is "killed: ./myprog".</p>
<p dir="auto">The system log reports:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ taskgated[92]: no signature for pid=1991 (cannot make code: UNIX[No such process])"><pre class="notranslate"><code class="notranslate">$ taskgated[92]: no signature for pid=1991 (cannot make code: UNIX[No such process])
</code></pre></div>
<p dir="auto">Tested against Go1.5beta2 and:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ go version devel +765cea2 Mon Jul 27 18:03:45 2015 +0000 darwin/amd64"><pre class="notranslate"><code class="notranslate">$ go version devel +765cea2 Mon Jul 27 18:03:45 2015 +0000 darwin/amd64
</code></pre></div>