title: Go, Golang : external package import with GOROOT
body: <p><a href="https://stackoverflow.com/questions/19073794/go-golang-does-not-make-sense-that-i-have-to-have-files-before-import">Go, Golang : does not make sense that I have to have files before import</a></p>
  
  <p>I am trying to go to next step but keep getting errors</p>
  
  <ol>
  <li>I have the package that I want to import ready.</li>
  <li>All I need to do is to import the external package from github and be able to use it on any code.</li>
  </ol>
  
  <p>So this is what I did.</p>
  
  <pre><code>mkdir $HOME/go
  export GOPATH=$HOME/go
  go get github.com/user/project
  </code></pre>
  
  <p>This runs successfully. I downloaded it onto here with source code files from github</p>
  
  <pre><code>/Users/user/go/src/github.com/user/project/project.go
  </code></pre>
  
  <p>So to use this package that I just import I do</p>
  
  <pre><code>go run /Users/user/Desktop/code.go
  </code></pre>
  
  <p>But I am getting the following errors</p>
  
  <pre><code> MacBook-Air:~ user$ go run /Users/user/Desktop/code.go 
   Desktop/code.go:32:8: cannot find package "project" in any of:
          /usr/local/go/src/pkg/project (from $GOROOT)
          /Users/user/go/src/project (from $GOPATH)
  </code></pre>
  
  <p>What should I do? AM I missing something? Thanks in advance and please help me. I wrote a lot of code but being very frustrated not being able to distribute it because of this.</p>