package main
import (
"fmt"
"controller/userhandler" //not able to import this custom package
"github.com/gin-gonic/gin"
"net/http"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
)
func main(){
}
The code below shows that Go is only searching for packages in GOROOT. After not finding controller/userhandler
in GOROOT, ideally, it should look for packages in GOPATH but it does not.
I have already set GOPATH to my workspace path which includes the folders: bin
, src
, and pkg
.
$ go build main.go
main.go:5:2: package controller/userhandler is not in GOROOT (/usr/local/go/src/controller/userhandler)