How does Go update third-party packages?

后端 未结 7 1125
盖世英雄少女心
盖世英雄少女心 2020-12-22 15:35

Looking how actively golang packages grow and improve I wonder how the problem with package versions is solved?

I see that one way is to store third-party packages u

7条回答
  •  清酒与你
    2020-12-22 16:01

    go get will install the package in the first directory listed at GOPATH (an environment variable which might contain a colon separated list of directories). You can use go get -u to update existing packages.

    You can also use go get -u all to update all packages in your GOPATH

    For larger projects, it might be reasonable to create different GOPATHs for each project, so that updating a library in project A wont cause issues in project B.

    Type go help gopath to find out more about the GOPATH environment variable.

提交回复
热议问题