News for hackers. Stuff that matters.
Re:Golang: Don't be afraid of makefiles by tptacek on Wednesday September 20, 2017 @11:44AM (#15295029)
I like Makefiles and Makefiles for Go are especially simple, but they don't play well with "go get", do they?
Re:Golang: Don't be afraid of makefiles by chimeracoder on Wednesday September 20, 2017 @12:04PM (#15295285)
> I like Makefiles and Makefiles for Go are especially simple, but they don't play well with "go get", do they?

They don't (`go get` won't execute anything defined in a Makefile), and the approach that the author takes to vendoring is also going to cause problems.

It's possible to have a Makefile that serves as a shim for the standard and recommended Go workflow, but it's not very easy, and it's ultimately an uphill battle. It's also not going to be cross-platform, unlike the Go toolchain.

Re:Golang: Don't be afraid of makefiles by kasey_junk on Wednesday September 20, 2017 @02:52PM (#15297032)
We don't use makefiles for cascading builds like you would in C and as such a lot of the power of Makefiles is lost in the golang world.

We do use them to specify "simple" repetitive tasks in a uniform way, with some minimal amount of order defined (for instance making sure go get is called before go test, or our code for embedding version numbers into binaries for builds).

[edit] An example from one of our public repos https://github.com/MediaMath/grim/blob/master/Makefile the codebase was one of our first times writing go so we aren't terribly proud of it, but the Makefile is representative of the kinds of things we do in make.

Re:Golang: Don't be afraid of makefiles by insertnickname on Wednesday September 20, 2017 @11:52AM (#15295130)
Just because you have a Makefile in your repository, it doesn't mean the package(s) aren't `go get`-able. As long as the package can be built with `go install`/`go build` it should be fine.
Re:Golang: Don't be afraid of makefiles by jerf on Wednesday September 20, 2017 @12:05PM (#15295291)
And there are cases where it is simply impossible for the package to be installed simply with "go get" or "go install". C'est la vie. The idea is not to unnecessarily introduce dependencies on things like make, not that you can remove the necessary dependencies on external tools.
Re:Golang: Don't be afraid of makefiles by tptacek on Wednesday September 20, 2017 @12:05PM (#15295293)
Right, but then the value of the Makefile is pretty marginal.
Re:Golang: Don't be afraid of makefiles by jeffinhat on Wednesday September 20, 2017 @12:18PM (#15295469)
The value of the Makefile is for automating repetitive dev tasks. Consumers of a golang CLI should use `go get` but this makes it easier for contributors who run tests, cut releases, ..

The authors example is clean/simple. Here's an example not so clean/simple example where we needed to do more complex stuff like build for all target platforms[1].

[1] https://github.com/cloudfoundry-community/stackdriver-tools/...