News for hackers. Stuff that matters.
Re:Go Modules in 2019 by zaphar on Wednesday December 19, 2018 @12:34PM (#18717466)
Pretty much every language has a GOPATH thing.

CLASSPATH, PYTHON_PATH, PERL5LIB, ...

I never really understand the hate here. It seems more like they didn't hate GOPATH specifically and more that they didn't like not having a package manager.

Re:Go Modules in 2019 by dagss on Wednesday December 19, 2018 @12:59PM (#18717705)
GOPATH behaves very, very differently from PYTHON_PATH and CLASSPATH, it is not the same thing at all.

Basically before go 1.11, it was impossible to just do

    git clone ... somedir
    cd somedir
    # build code and run something
You had to instead make sure "somedir" ended up somewhere within a particular deep directory structure. That is what people mean when they say "GOPATH".
Re:Go Modules in 2019 by Merovius on Wednesday December 19, 2018 @06:16PM (#18720885)
> Basically before go 1.11, it was impossible to just do

That's not true. It was always perfectly possible to do that, the code you build just couldn't import any libraries not installed in GOPATH. AIUI that is exactly the same as in other languages.

Re:Go Modules in 2019 by dagss on Thursday December 20, 2018 @02:56AM (#18723207)
Our git repo for a backend service contains dozens of packages, and many small packages is recommended in go, and they do need to import one another...

I guess it is not all that different from Python, with Python you need to add the source path to PYTHONPATH / sys.path (and often do so at runtime in the entrypoint script). With go you need the "src/github.com/dagss" prefix to the path. Or at least, according to conventions. You are right that it is more similar on a technical level than what I thought.

Re:Go Modules in 2019 by pjmlp on Wednesday December 19, 2018 @12:53PM (#18717653)
The ones listed by you apply mostly as library search path, while go compilers required GOPATH to point to the project being compiled.
Re:Go Modules in 2019 by kjksf on Wednesday December 19, 2018 @04:38PM (#18719948)
False.

You can put your code anywhere you want and `go build` and `go run` will work just fine.

It's only third party libraries that have to be in GOPATH, which is exactly a library (well, package) search path.

Re:Go Modules in 2019 by aeijdenberg on Wednesday December 19, 2018 @05:11PM (#18720258)
False only for very small values of code.

ie if your code itself is split into modules, they won't work (as they are imported by their full path, not relatively), and anything in your vendor dir is also ignored when used outside of a GOPATH entry.

Re:Go Modules in 2019 by mkozlows on Wednesday December 19, 2018 @01:03PM (#18717740)
Java, Perl, and Python all date back to the '90s. Yeah, that was a commmon pattern in the '90s.