title: Using "go get" to download binaries without adding them to go.mod
body: <p>I'm using Go modules in my project and in my build system (e.g. Travis CI) I'm downloading a command-line utility (written in Go) with <code>go get</code> to assist with my build process, e.g.:</p>
  
  <pre><code>go get github.com/mitchellh/gox
  </code></pre>
  
  <p>However, this <code>go get</code> causes the file to be added to my <code>go.mod</code> file. This is contaminating the build environment, causing it to be "dirty" (since there are changes to some files tracked in git, in this case go.mod and go.sum), and I use <code>git describe --always --dirty --tag</code> to describe my build, which shows up as "dirty".</p>
  
  <p>Is there a way to "go get" a binary just to download it, without adding it to the go.mod/go.sum?</p>
  
  <p>I've tried setting GOPATH to somewhere else, even then, <code>go get</code> updates the go.mod/go.sum to add this as an <code>// indirect</code> dependency.</p>
  
  <pre class="lang-sh prettyprint-override"><code>dir="$(mktemp -d)"; \
    env GOPATH="$dir" go get github.com/mitchellh/gox &amp;&amp; \
    mv "$dir/bin/gox" "$(go env GOPATH)"/bin/gox
  </code></pre>