0

I want to have all of my dependencies under source control alongside my projects in Go.

I can see there two main tools to do the job ( Dep and Glide ).

The problem is Dep States on its page that :

dep was the "official experiment." The Go toolchain, as of 1.11, has (experimentally) adopted an approach that sharply diverges from dep. As a result, we are continuing development of dep, but gearing work primarily towards the development of an alternative prototype for versioning behavior in the toolchain.

While Glide on the other hand, does not seem to have any activity on its repo.

I want to know what's the "best" way you guys are dealing with this?

I really love Go and it's philosophy but I must admit that dependency management is really messy.

Matias Barrios
  • 4,674
  • 3
  • 22
  • 49

2 Answers2

1

I'm not a Golang expert so I may be wrong, but according to the golang/go wiki:

For any production workloads, use dep, or migrate to it if you have not done so already.

The proposal has been accepted and vgo was merged into the Go tree in version 1.11.

You will be able to experiment with the module workflow from Go 1.11 as it is included as an experiment in this release.

So it appears like module support is in experimental mode for now and you should stick with dep for any production ready code until vgo gets fully integrated.

Note that dep has its own set of problems, as explained in this article, mostly revolving around conflicting version and transitive dependencies management. Until vgo is considered production ready my understanding is that you will need to deal with these problems yourself.

edit: added section about dep problems.

Sir Celsius
  • 822
  • 8
  • 22
1

In my experience, my solution is using go modules to manage dependencies. I got some problems with dep when install dependencies and it take me a lot of effort to fix it. So I switch to go module and it working as expect on production environment. Module is a built-in feature in Go which was introduced in Go 1.11 and starting in Go 1.13, module mode will be the default for all development.

Go modules make install dependencies faster and easier. With module, all dependencies will be listed in go.mod file:

module example.com/hello

require (
    github.com/some/dependency v1.2.3
    github.com/another/dependency/v4 v4.0.0
)

How to get dependency:

go get github.com/some/dependency@v1.2.3
Tuan Nguyen
  • 249
  • 1
  • 3
  • 12