How to force import packages from a supplier?

I tested the provider function in smoothing mode. It was great to install all the packages, but I was not able to get the go team to find them in the vendor packages.

go run src/main.go

src/main.go:8:2: cannot find package "github.com/valyala/fasthttp" in any of:
   /home/joaonrb/.software/lib/go/go1.7/src/github.com/valyala/fasthttp (from $GOROOT)
   /home/joaonrb/.projects/go-blog/src/github.com/valyala/fasthttp (from $GOPATH)

Fasthttp is installed in /home/joaonrb/.projects/go-blog/src/vendor/github.com/valyala/fasthttp, the go version I'm using is 1.7, and my GOPATH is/home/joaonrb/.projects/go-blog

+4
source share
1 answer

Your GOPATH structure seems invalid. To do what you want:

  • Create a project folder, for example. $GOPATH/src/myproj.
  • Put your main.go there.
  • Create a supplier folder there, for example. $GOPATH/src/myproj/vendor.
  • Put github.com/valyala/fasthttpthere.

That should work.

+7
source

Source: https://habr.com/ru/post/1654821/


All Articles