title: How to make go search for packages in GOPATH while importing a package?
body: <pre class="lang-golang prettyprint-override"><code>package main
  
  import (
      &quot;fmt&quot;
      &quot;controller/userhandler&quot;   //not able to import this custom package      
      &quot;github.com/gin-gonic/gin&quot;                                         
      &quot;net/http&quot;                                                         
      &quot;github.com/jinzhu/gorm&quot;                                               
    _ &quot;github.com/jinzhu/gorm/dialects/postgres&quot;
  )
  
  func main(){
  }
  </code></pre>
  <p>The code below shows that Go is only searching for packages in GOROOT. After not finding <code>controller/userhandler</code> in <strong>GOROOT</strong>, ideally, it should look for packages in <strong>GOPATH</strong> but it does not.</p>
  <p>I have already set <strong>GOPATH</strong> to my workspace path which includes the folders: <code>bin</code>, <code>src</code>, and <code>pkg</code>.</p>
  <pre class="lang-sh prettyprint-override"><code>$ go build main.go                                                           
  main.go:5:2: package controller/userhandler is not in GOROOT (/usr/local/go/src/controller/userhandler)
  </code></pre>