News for hackers. Stuff that matters.
Re:Go best practices, six years in (2016) by Goopplesoft on Friday March 02, 2018 @10:37AM (#16502285)
Is anyone else using golang dep[1] as their vendor/dependency tool?

I’ve used it and it works great (much better than glide, gb et al) but I don’t see it in the wild too often.

[1] https://github.com/golang/dep

Re:Go best practices, six years in (2016) by pjmlp on Friday March 02, 2018 @10:43AM (#16502343)
Well, it is on its way out, have you missed the news regarding vgo?

https://research.swtch.com/vgo

Re:Go best practices, six years in (2016) by chimeracoder on Friday March 02, 2018 @12:49PM (#16503900)
> Well, it is on its way out, have you missed the news regarding vgo?

Dep will have a clean migration path to vgo, and the latter isn't really production-ready yet.

For now, I'd recommend using dep for daily use, until you have a compelling reason to switch to vgo, at which point the migration will probably be automatic.

Re:Go best practices, six years in (2016) by kitd on Friday March 02, 2018 @10:48AM (#16502405)
Er, thanks. We've just moved to go dep :)

Go's dependency management story is starting to resemble JS's modules story :(

Re:Go best practices, six years in (2016) by dilap on Friday March 02, 2018 @10:52AM (#16502472)
Yeah... In defense of the Go folks (1) they are working hard to make the transition as smooth as possible (2) dep was always just considered an experiment (though with aspirations by the author to have it become the official solution) (3) vgo almost certainly marks the end of the churn, and looks really nice.
Re:Go best practices, six years in (2016) by allover on Friday March 02, 2018 @05:47PM (#16506475)
> Go's dependency management story is starting to resemble JS's modules story

It's worse tbh. npm was actually always usable if you knew what you were doing. Complaints with npm were generally down to misunderstanding, people not being aware of features like 'npm shrinkwrap' (which has now been replaced with a lockfile-by-default strategy) and of course registry issues (allowing unpublishing) that weren't unique to npm, and were only an issue for people relying on public registries at deploy-time, a bad idea.

Re:Go best practices, six years in (2016) by lobster_johnson on Friday March 02, 2018 @01:27PM (#16504283)
vgo is at least phrased as being a proposal, not necessarily the future of Go [1]:

    This post sketches a proposal for doing exactly
    that, along with a prototype demonstration ...
    I intend this post to be the start of a productive
    discussion about what works and what doesn't.
    Based on that discussion, I will make adjustments
    to both the proposal and the prototype, and then 
    I will submit an official Go proposal, for
    integration into Go 1.11 as an opt-in feature.
Of course, this is Russ Cox, so chances are that his proposal will carry more weight with his fellow core Go team than that of Dep's authors.

Sam Boyer's follow-up is interesting reading [2]. I get the feeling that despite their ongoing discussions, the Dep team was/felt ambushed by this move.

[1] https://research.swtch.com/vgo-intro

[2] https://sdboyer.io/blog/vgo-and-dep/

Re:Go best practices, six years in (2016) by vorg on Friday March 02, 2018 @04:39PM (#16505980)
The distrust of anything "not invented here" is prevalent in big corps like Google.
Re:Go best practices, six years in (2016) by lobster_johnson on Friday March 02, 2018 @01:19PM (#16504232)
We use Dep. It's good, much better than the buggy mess that is/was Glide.

My only criticism is that "dep ensure" will actually parse the code to discover dependencies through import statements, which is also what Glide does. To me, this is antithetical to the purpose of a Gopkg.toml/lock file. In other words, Dep's full list of dependencies isn't actually in the Gopkg.toml file; it's a sum of Gopkg.toml and your code. That is confusing.

My desired behaviour:

* "dep ensure" should always used the lock file, nothing else, to install;

* "dep ensure -update" should update the lock file to what is specified in Gopkg.toml (and only that);

* "dep ensure -add" (which I think should be "dep add") should b required to add new dependencies to the Gopkg.toml file.

Aside: I wish Go projects weren't stuck with BSD style flags (-update instead of --update). GNU style is more common and arguably more practical. I applaud whenever a project (e.g. Prometheus, recently) finally sees sense and goes over to GNU flags.

Re:Go best practices, six years in (2016) by tynorf on Friday March 02, 2018 @04:06PM (#16505689)
I'm fairly certain you can use `--flag` with the standard flag package from stdlib: https://godoc.org/flag (in the section on command line flag syntax).

Though supporting `-flag` does remove the very nice combining of short flags.

Re:Go best practices, six years in (2016) by lobster_johnson on Friday March 02, 2018 @04:14PM (#16505746)
Interesting, I didn't know that. I never liked the flag package, and the downside you mention is a reason not to use it. Kingpin (used by the Prometheus projects) and go-flags are nicer. Lots of Google code uses spf13's pflag, which I'm not a fan of, but it does do GNU flags correctly.
Re:Go best practices, six years in (2016) by latchkey on Saturday March 03, 2018 @10:33AM (#16509654)
The weird thing is if you -add a dependency before you import it, then you get a warning that the dependency isn't used in the codebase yet. Of course it isn't, I just added it! My IDE (IDEA) resolves the imports for me, so I can't add the import until after I add the dependency. Nice little catch-22.
Re:Go best practices, six years in (2016) by lobster_johnson on Saturday March 03, 2018 @12:00PM (#16510166)
Good point, I dislike that behaviour, too.
Re:Go best practices, six years in (2016) by nzoschke on Friday March 02, 2018 @10:49AM (#16502422)
Yes using dep full time for projects andnit has been great.

I think it’s the right choice for now. It was going to be the one true solution and many people have stopped working on the alternatives.

We’ll see where vgo lands, but dep is very practical right now.