4 ms·
Create the folder ~/Projects/go and use it as gopath, I recommend a vendoring tool to prevent cluttering.
by tscs37 10y ago
Create the folder ~/Projects/go and use it as gopath, I recommend a vendoring tool to prevent cluttering.
- zamalek 10y agoMost tutorials (all? I had to RTFM) outright omit how to use gopath. Especially with forks.
- tscs37 10y agoBad tutorials then.
- matthewmacleod 10y agoRight, but if all of the tutorials are bad, it kind of points to a problem elsewhere.
- omginternets 10y agoThat people aren't RTFM-ing?
- matthewmacleod 10y agoNo - that the ecosystem or decisions are difficult to understand or communicate effectively.
- omginternets 10y agoSetting an environment variable is trivial, and becoming aware of this requirement also trivial. It's all but spoon-fed here [0] and here [1]. I've never encountered anyone -- both online and offline -- who has had trouble with this beyond "huh, I didn't know I had to do that. Duly noted". Until now, that is. You are making a mountain out of a molehill ... nay, an anthill. [0] https://golang.org/doc/install https://golang.org/doc/install [1] https://golang.org/doc/code.html https://golang.org/doc/code.html
- tscs37 10y agohttps://golang.org/doc/install https://golang.org/doc/install This is the official installation document. If you have problems finding proper tutorials, there is also https://tour.golang.org https://tour.golang.org which also links to the previous document on install instructions.
- PopsiclePete 10y agoMust be some shit tutorials. The ones I read were great. Did you just take "some-random-guy"'s blog at face value? There's an official Go home-page full of beginner guides.
- matthewmacleod 10y agoThis is what I've ended up doing, and it still drives me absolutely batty. Typically I'd group together all of the code and assets for a project in one place; any Go code has to exist in this separate namespace for no convincing reason. It's fine, I can work around it, but it's still quite annoying.
- ptero 10y agoI think I am in the same boat -- Go file layout model seems to be for multiple projects written in Go instead of (my typical case) a multi-language project with a component in Go. It is not really a big deal, I can overcome it with some simlinks and conventions, but this is not elegant; I hope a model to support this better will be added sometime.
- coldtea 10y ago>any Go code has to exist in this separate namespace for no convincing reason. The convincing reason is that you get several automated behaviors in fetching, installing and building this way. If you don't care for those, you can use whatever path you like for your code, and a custom makefile for building. Just don't expect "go build", "go install" etc to work.
- hazbo 10y agoSomething I pretty much do and have heard from other Go people that they do this also, is to just keep all my projects in the GOPATH. Whether they be written in Go or not. It essentially gives you an organised structure based on git URLs, so it's always easy to find anything. I use $HOME/go, and have projects in there written in a bunch of languages.
- woah 10y agoI do this. It's actually a pretty good way to organize code in general, not just Go. Still dumb that they force it on you.
- manojlds 10y agoRelated - https://github.com/kylebanks/goggles https://github.com/kylebanks/goggles