Purpose: use web sockets for go. Most of the examples found on the network use the Gorilla library, connected as follows:

import "github.com/gorilla/websocket" 

If I understand correctly, to use this package ( github.com/gorilla/websocket ) locally, you need to get it in advance:

 go get "github.com/gorilla/websocket" 

Actually, the question is: after executing the aforementioned command, two directories appear in the directory of our Go project, in one of which there is a binary, in the other - a lot of raw materials; Are all pumped raws necessary? Is there any more universal ("correct") way to use third-party packages in their projects?

    1 answer 1

    From your question, I assume that you have GOPATH installed in the root of the project. This practice is not recommended. One GOPATH is recommended for all projects. First of all, because it allows you to control which code gets into the project and which does not, plus makes your project compatible with go get .

    As for maintaining dependencies, the most reliable and frequently used tactic is the so-called. "Vending". That is, saving dependencies in the /vendor folder in the project root. You can do this for example using https://github.com/tools/godep :

     godep save ./... 
    • Yes, you are absolutely right about GOPATH. Thanks for the help! - isnullxbh
    • I use github.com/govend/govend on my project to manage dependencies. - mks