Hacker News new | ask | show | jobs
by Strum355 2540 days ago
Info about workspace is outdated. Go modules allows you to to work outside GOPATH
4 comments

I recently hastily put together a "Learn Go in 10 days" program for my team, where I only used go modules: https://github.com/hliyan/learn-golang/blob/master/day-08/ma...

Feedback welcome.

Thanks so much for sharing. Very helpful to me.
Some useful tools[0] are still to catch up with Go modules, so using GOPATH still makes sense if you use them.

[0] https://github.com/golang/go/issues/24661

Agree. With go mod we workspace can be outside of GOPATH. The post does not cover go mod.
agree, newbie to golang, just started with go1.13beta1 which will make go-module preferred to GOPATH/workspace.
The default mode is already `auto`, which checks if you're within GOPATH (if GOPATH is set) and defaults to mod if you're not.
don't know this, thanks! I also assume you no longer need set GO111MODULE=on anymore
That depends -- it defaults to "auto" which means that its enabled outside of $GOPATH but disabled inside it. If you're working on a project that makes use of "go mod vendor" and is built from within your $GOPATH (which is true of quite a few free software Go projects) then you'll need it.