title: How to import a golang own package?
body: <p>I have problems with importing a package. I want to import the <code>"golang.org/x/tools/cmd/oracle"</code> and the <code>"golang.org/x/tools/oracle"</code> package.</p>
  
  <p>Which is the correct way to import these packages?</p>
  
  <hr>
  
  <p>This the way I try to import the packages:</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "strings"
      "os"
      "os/exec"
      "golang.org/x/tools/oracle"
      "golang.org/x/tools/cmd/oracle"
  )
  </code></pre>
  
  <p>The both last imports leads to the following problem:</p>
  
  <pre><code>====================  Starting Go build  ====================
  Cleared problem markers for ProjektGO.
  ************  Building Go project: ProjektGO  ************
    with GOPATH: /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO
  &gt;&gt; Running: /usr/lib/go/bin/go install -v -gcflags "-N -l" ./...
  file/main.go:13:2: cannot find package "golang.org/x/tools/cmd/oracle" in any of:
      /usr/lib/go/src/golang.org/x/tools/cmd/oracle (from $GOROOT)
      /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/golang.org/x/tools/cmd/oracle (from $GOPATH)
  file/main.go:12:2: cannot find package "golang.org/x/tools/oracle" in any of:
      /usr/lib/go/src/golang.org/x/tools/oracle (from $GOROOT)
      /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/golang.org/x/tools/oracle (from $GOPATH)
     ^^^ Terminated, exit code: 1 ^^^
  ************  Build terminated.  ************
  </code></pre>
  
  <hr>
  
  <p>Then I tried things like that:</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "strings"
      "os"
      "os/exec"
      "../../../../../golang.org/x/tools/cmd/oracle"
      "../../../../../golang.org/x/tools/oracle"
  )
  </code></pre>
  
  <p>And the result was this:</p>
  
  <pre><code>====================  Starting Go build  ====================
  ************  Building Go project: ProjektGO  ************
    with GOPATH: /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO
  &gt;&gt; Running: /usr/lib/go/bin/go install -v -gcflags "-N -l" ./...
  can't load package: /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/file/main.go:11:2: import "../../../../../golang.org/x/tools/cmd/oracle" is a program, not an importable package
  ../../../../golang.org/x/tools/oracle/describe.go:20:2: cannot find package "golang.org/x/tools/go/ast/astutil" in any of:
      /usr/lib/go/src/golang.org/x/tools/go/ast/astutil (from $GOROOT)
      /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/golang.org/x/tools/go/ast/astutil (from $GOPATH)
  ../../../../golang.org/x/tools/cmd/oracle/main.go:26:2: cannot find package "golang.org/x/tools/go/buildutil" in any of:
      /usr/lib/go/src/golang.org/x/tools/go/buildutil (from $GOROOT)
      /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/golang.org/x/tools/go/buildutil (from $GOPATH)
  ../../../../golang.org/x/tools/oracle/callers.go:11:2: cannot find package "golang.org/x/tools/go/callgraph" in any of:
      /usr/lib/go/src/golang.org/x/tools/go/callgraph (from $GOROOT)
      /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/golang.org/x/tools/go/callgraph (from $GOPATH)
  ../../../../golang.org/x/tools/cmd/oracle/main.go:27:2: cannot find package "golang.org/x/tools/go/loader" in any of:
      /usr/lib/go/src/golang.org/x/tools/go/loader (from $GOROOT)
      /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/golang.org/x/tools/go/loader (from $GOPATH)
  ../../../../golang.org/x/tools/oracle/callees.go:17:2: cannot find package "golang.org/x/tools/go/pointer" in any of:
      /usr/lib/go/src/golang.org/x/tools/go/pointer (from $GOROOT)
      /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/golang.org/x/tools/go/pointer (from $GOPATH)
  ../../../../golang.org/x/tools/oracle/callees.go:18:2: cannot find package "golang.org/x/tools/go/ssa" in any of:
      /usr/lib/go/src/golang.org/x/tools/go/ssa (from $GOROOT)
      /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/golang.org/x/tools/go/ssa (from $GOPATH)
  ../../../../golang.org/x/tools/oracle/callees.go:19:2: cannot find package "golang.org/x/tools/go/ssa/ssautil" in any of:
      /usr/lib/go/src/golang.org/x/tools/go/ssa/ssautil (from $GOROOT)
      /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/golang.org/x/tools/go/ssa/ssautil (from $GOPATH)
  ../../../../golang.org/x/tools/oracle/describe.go:22:2: cannot find package "golang.org/x/tools/go/types/typeutil" in any of:
      /usr/lib/go/src/golang.org/x/tools/go/types/typeutil (from $GOROOT)
      /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/golang.org/x/tools/go/types/typeutil (from $GOPATH)
  ../../../../golang.org/x/tools/cmd/oracle/main.go:28:2: cannot find package "golang.org/x/tools/oracle" in any of:
      /usr/lib/go/src/golang.org/x/tools/oracle (from $GOROOT)
      /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/golang.org/x/tools/oracle (from $GOPATH)
  ../../../../golang.org/x/tools/oracle/callees.go:20:2: cannot find package "golang.org/x/tools/oracle/serial" in any of:
      /usr/lib/go/src/golang.org/x/tools/oracle/serial (from $GOROOT)
      /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/golang.org/x/tools/oracle/serial (from $GOPATH)
  ../../../../golang.org/x/tools/oracle/implements.go:21:2: cannot find package "golang.org/x/tools/refactor/importgraph" in any of:
      /usr/lib/go/src/golang.org/x/tools/refactor/importgraph (from $GOROOT)
      /home/haapoo/go/src/github.com/ProjektarbeitGo/ProjektGO/src/golang.org/x/tools/refactor/importgraph (from $GOPATH)
     ^^^ Terminated, exit code: 1 ^^^
  ************  Build terminated.  ************
  </code></pre>
  
  <hr>
  
  <p>My GOROOT is <code>/usr/lib/go</code> and my GOPATH is <code>/home/haapoo/go</code> .
  I know the question about gopath and goroot comes often but maybe anyone has an idea.</p>
  
  <p>PS: I use goclipse</p>
  
  <p>Greetings
  haapoo</p>