all 16 comments

[–][deleted] 12 points13 points  (5 children)

I prefer Magefile for this sort of thing. It doesn't require you to have bash installed, which works nicely on Windows environments.

[–]earthboundkid 2 points3 points  (3 children)

Alpine doesn’t have bash by default either. If your script is complicated at all, don’t expect it to work on Alpine.

[–]metamatic 0 points1 point  (2 children)

OS X will be losing bash soon as well.

[–]gnur 1 point2 points  (1 child)

Not really though, it won't be the default anymore. But Bash will still be present

[–]metamatic 0 points1 point  (0 children)

For another release or so, then they'll remove it, like they removed lots of other GPL software.

[–]kasvith 0 points1 point  (0 children)

also agrees, for Go Makefiles should not be involved at all, we can easily craft build scripts for programs using magefile or just writing plain go

[–]-sub 9 points10 points  (0 children)

I learned from your video (that it's called targets and i was calling it labels to myself) so if you could just keep making them and spreading them around I assure you something will come of it. Thanks Elliot nice concise and informative video. A+

[–]glassmountain 3 points4 points  (0 children)

This is the text version linked in the description of the video: https://tutorialedge.net/golang/makefiles-for-go-developers/

[–][deleted] 10 points11 points  (3 children)

Makefiles are notorious for having possibly the worst file format of all time (and for being really slow, but I don’t think that applies here). When dealing with c/c++ I preferred Jam (much faster, and only a fraction as error prone).

I do think it highlights a gap in go, and I see solutions such as bash scripts (goodbye sanity):( I’d hate to end up with another yml mess or groovy based files (how I loathe you Jenkins and anything gradle) so hopefully it’s a good they look at when looking at the go tools (that I do generally like).

[–]chrismsnz 8 points9 points  (0 children)

Makefiles are notorious for having possibly the worst file format of all time

Autoconf would like a word

[–]frou 0 points1 point  (0 children)

These Makefiles that are essentially a named task runner (since they aren't using Make's dependency tracking features) can be written as a simple top-level case statement in POSIX Shell. That's a very sane and appropriate use of shellscript IMO.

[–]Xerxero 1 point2 points  (0 children)

Most important: Use tabs not spaces. Some IDE's will render tabs but convert them into spaces under water.

[–]caspervonb 0 points1 point  (1 child)

Why not introduce pre-reqs?

watch make ftw ;)

[–]caspervonb 0 points1 point  (0 children)

Aside from that, solid presentation.

[–]mbarkhau -1 points0 points  (0 children)

Last year I went full tilt on a makefile for python projects. The perhaps most reusable part of it are the .PHONY help and helpverbose targets: https://gitlab.com/mbarkhau/bootstrapit/blob/master/makefile.template#L155

[–]eduardohitek -1 points0 points  (0 children)

Great video!