title: Static linking against external library
body: <p>I'm trying to understand how to build static executable in Go and I need to link it against external library, in my case ORACLE, but the use case is generic. I do the following:</p>
  
  <pre><code>go build -x --ldflags '-s -w -extldflags "-static -L$ORACLE_HOME/lib -lclntsh"'
  </code></pre>
  
  <p>The compilation phase is fine, but linking part fails to find external lib(s):</p>
  
  <pre><code>/path/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
  /path/x86_64-redhat-linux-gnu/bin/ld: cannot find -lclntsh
  </code></pre>
  
  <p>I'm skipping here full path for better readability.
  The gcc linker can't see passed -L path and library (in my case -L$ORACLE_HOME/lib -lclntsh).</p>
  
  <p>So, the question is how for any generic case to pass external library path and libs to linker using go build command.</p>