<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ uname -a
Darwin users-MacBook-Air.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
$ go version
go version devel +c468957 Sun Sep 27 01:04:59 2015 +0000 darwin/amd64

# The only thing the program does is fmt.Print(&quot;Hello\n&quot;)
$ cd hello
$ go build -ldflags -w
$ hexdump -C hello | grep -c `basename $HOME`
58"><pre class="notranslate">$ uname -a
Darwin users-MacBook-Air.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015<span class="pl-k">;</span> root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
$ go version
go version devel +c468957 Sun Sep 27 01:04:59 2015 +0000 darwin/amd64

<span class="pl-c"><span class="pl-c">#</span> The only thing the program does is fmt.Print("Hello\n")</span>
$ <span class="pl-c1">cd</span> hello
$ go build -ldflags -w
$ hexdump -C hello <span class="pl-k">|</span> grep -c <span class="pl-s"><span class="pl-pds">`</span>basename <span class="pl-smi">$HOME</span><span class="pl-pds">`</span></span>
58</pre></div>
<p dir="auto">by <strong>awreece</strong>:</p>
<pre class="notranslate">This is a feature request for an additional flag for compilation to create a sanitized
or hardened binary. 

This binary could include a number of features, espescially including:
- fake paths (ala /go/root/&lt;pkgname&gt; instead of the real filename) 
- doesn't have stack tracing on panic
- doesn't print faulting instruction, address on segfault

The existing pack tool allows you to strip prefixes from paths, but there's no option to
pass that through the go build tool chain. Furthermore, this doesn't disable printing
stack traces, etc.</pre>