title: golang: go install tries /usr/local instead of GOPATH
body: <p>This is somewhat a follow-up to my last question: <a href="https://stackoverflow.com/questions/12514037/golang-installing-packages-in-a-local-directory">golang: installing packages in a local directory</a></p>
  
  <p>I have <code>GOPATH</code> set to <code>$HOME/prog/go/gopath</code> and this path exists with three directories:</p>
  
  <pre><code>~/prog/go/gopath$ ls
  bin  pkg  src
  </code></pre>
  
  <p>Now I try to install a <a href="https://github.com/alphazero/Go-Redis" rel="noreferrer">module to access the redis database</a> which asks me to run</p>
  
  <pre><code>go install
  </code></pre>
  
  <p>inside the source directory. But the command <code>go install</code> gives me</p>
  
  <pre><code>~/prog/go/gopath/src/redis (go1)$ go install
  go install flag: open /usr/local/go/pkg/darwin_amd64/flag.a: permission denied
  ~/prog/go/gopath/src/redis (go1)$ echo $GOPATH 
  &lt;myhomedir&gt;/prog/go/gopath
  </code></pre>
  
  <p>(where <code>&lt;myhomedir&gt;</code> is a valid path)</p>
  
  <p>Question 1: why does <code>go install</code> not take <code>$GOPATH</code> into account?
  Question 2: how to convince <code>go install</code> to use <code>$GOPATH</code>?</p>