title: How to import local packages in go?
body: <p>I am new to go and working on an example code that I want to localize.</p>
  <p>In the original <code>main.go</code> import statement it was:</p>
  <pre><code> import (
      &quot;log&quot;
      &quot;net/http&quot;
      &quot;github.com/foo/bar/myapp/common&quot;
      &quot;github.com/foo/bar/myapp/routers&quot;
  )
  </code></pre>
  <p>Now I have <code>common</code> and <code>routers</code> package in <code>/home/me/go/src/myapp</code></p>
  <p>So I converted the import statement to:</p>
  <pre><code>import (
      &quot;log&quot;
      &quot;net/http&quot;
      &quot;./common&quot;
      &quot;./routers&quot;
  )
  </code></pre>
  <p>But when I run <code>go install myapp</code> I get these errors:</p>
  <pre><code>can't load package: /home/me/go/src/myapp/main.go:7:3: local import &quot;./common&quot; in non-local package
  </code></pre>
  <p>Also, when I use <code>common</code> and <code>routers</code> instead of <code>./common</code> and <code>./routers</code> in the import statement, I get:</p>
  <pre><code>myapp/main.go:7:3: cannot find package &quot;common&quot; in any of:
      /usr/local/go/src/common (from $GOROOT)
      /home/me/go/src/common (from $GOPATH)
  myapp/main.go:8:2: cannot find package &quot;routers&quot; in any of:
      /usr/local/go/src/routers (from $GOROOT)
      /home/me/go/src/routers (from $GOPATH)
  </code></pre>
  <p>How can I fix this?</p>