News for hackers. Stuff that matters.
Re:Golang: Don't be afraid of makefiles by iambvk on Wednesday September 20, 2017 @12:38PM (#15295694)
After struggling a lot, I think, I finally understood best use for GOPATH with Makefile based projects. I use it as follows:

I have ~/go for all 3rd party code that I did not develop. My personal projects live in a different directory with a different structure (including, configure.ac, Makefile.am, etc.). My projects tend to use multiple languages, so I need Makefile support.

I fix GOPATH in project specific Makefiles with ~/go as the first directory followed by project specific directory for Go code. For example, I add the following in Makefile.am of every project.

GOPATH := $(HOME)/go:$(CURDIR)/go

One cool result of this is: When I do go-get of any 3rd party package (either through command-line or as part of a rule from Makefiles), Go downloads them into ~/go directory (it picks the first directory in GOPATH or defaults to ~/go). This leaves my project specific directories free of 3rd party code -- which is what I want.

End result is, ~/go ends up with 3rd party code from across all projects and it doesn't include my project code, so can be deleted any time and re-created automatically by Makefile rules.

Re:Golang: Don't be afraid of makefiles by Groxx on Wednesday September 20, 2017 @08:18PM (#15299558)
How do you deal with conflicting versions?
Re:Golang: Don't be afraid of makefiles by iambvk on Friday September 22, 2017 @09:36PM (#15317501)
Honestly, I didn't face that issue till now.