News for hackers. Stuff that matters.
Re:Go += Package Versioning by warent on Tuesday February 20, 2018 @01:44PM (#16422773)
I've been programming in Go for a couple of years now and found that this need to use "hacks ... to avoid it" is totally naive and irrational.

Agreed, GOPATH is awkward--at first. Because it's different from what most programmers are used to. But once it's adopted it actually makes a lot of sense, and looking back it seems bizarre to ever have such a strong desire to avoid it at all costs--and the costs are high.

The same applies for Gofmt as well.

Re:Go += Package Versioning by Sir_Cmpwn on Tuesday February 20, 2018 @01:46PM (#16422786)
I should add that another big part of the reason I've been avoiding the language for years is the cult of Golang telling me my complaints are "totally naive and irrational".
Re:Go += Package Versioning by dasacc22 on Tuesday February 20, 2018 @02:18PM (#16423186)
I've been working with Go for 6 years, your complaints are not "totally naive and irrational".

I don't mind GOPATH, but I did argue that if vendoring was to be a thing then it needed to be dropped entirely. I was also not a fan of the vendoring mechanism.

The approach given here looks much more thought out getting rid of each, first proposal I've actually liked.

Re:Go += Package Versioning by Groxx on Wednesday February 21, 2018 @12:14AM (#16427025)
This kind of attitude around package management and especially dependency injection have been major turn-offs for me as well. More than a sufficient number of the community has been emitting a high-pressure stream of NIH combined with ignorance of existing solutions, and it has been crippling the community for years.
Re:Go += Package Versioning by neoasterisk on Wednesday February 21, 2018 @03:07AM (#16427784)
Dependency injection is very commonly used in the Go ecosystem. Do not confuse resistance about unidiomatic DI frameworks with resistance about DI itself.
Re:Go += Package Versioning by Groxx on Wednesday February 21, 2018 @09:25PM (#16434726)
Which ones are common? I've been hoping this would be the case, but I've been unable to find evidence for it.

e.g. the most-popular one I can see so far is Facebook's "inject", which has a remarkably small 841 stars: https://github.com/facebookgo/inject

Even Glide, Godep, and Dep have several thousand. And those can barely claim "most", much less "very common".

Re:Go += Package Versioning by neoasterisk on Thursday February 22, 2018 @05:32AM (#16436629)
What do you mean which ones? I am talking about dependency injection as a technique/pattern. In Go you can just do it without importing anything.

Please read:

https://medium.com/@benbjohnson/standard-package-layout-7cdb...

(I've linked to the exact point in the article where it talks about DI but you might want to read the rest as well.)

Re:Go += Package Versioning by Groxx on Thursday February 22, 2018 @04:49PM (#16441751)
Yeah, it's widespread as a hand-coded thing. It has to be - you essentially have no choice in Go for even basic things like tests.

But that just means that everyone rolls their own thing by hand, with widely-varying feature-sets, method names, bugs, etc. DI frameworks are very much nicer for interop between a bunch of libs.

Re:Go += Package Versioning by stormbeta on Tuesday February 20, 2018 @01:58PM (#16422948)
gofmt, sure. Consistency in style is great.

But GOPATH was a mistake in the same way Go's hitherto lack of versioning was: it deliberately breaks easy isolation between projects / dependency management.

This mindset only works if you control most of the ecosystem (such as with a monorepo), but it's a irritating mess otherwise.

Re:Go += Package Versioning by slrz on Tuesday February 20, 2018 @10:20PM (#16426571)
But you do control all the source code within your GOPATH! It's right there on your file system.

There's also a mechanism to take control of the same code even when it's outside your GOPATH. Github calls this mechanism a "pull request".

Re:Go += Package Versioning by __david__ on Tuesday February 20, 2018 @02:00PM (#16422963)
It's really not irrational to want to organize my projects in a way other than by their (current) git repo URL. It's also not irrational to not want disparate projects to not share the same pool of dependencies (which even go has begrudgingly accepted as evidenced by "dep" and this proposal). Go is alright but I refuse to drink the GOPATH cool aid.
Re:Go += Package Versioning by ovao on Tuesday February 20, 2018 @05:20PM (#16424793)
It’s totally reasonable to want to organize projects in a different way, but I think GOPATH’s caveats are overstated.

- It’s an evironment variable, which makes it relatively easy to modify. To switch your dependencies from one pool to another, you can modify your GOPATH.

- The vendor directory lets you pin your dependencies per-project without modifying GOPATH. It’s not the most beautiful solution (and Go doesn’t often offer the most beautiful solution to any particular thing), but it’s workable.