Introduction to Makefiles
Explore the role of Makefiles in Go command-line development. Understand how Make automates builds, testing, and deployments, its advantages, drawbacks, and how to effectively use Makefiles for Go projects like multi-git.
I have a love-hate relationship with Makefiles. They are useful but have a lot of gotchas. In this lesson, we will explore the good, the bad, and the ugly of Makefiles. We will also discuss Makefiles for Go programs specifically.
Overview
In previous lessons we have embedded information into multi-git using some esoteric go build flags, we have built a simple CI/CD pipeline for multi-git using GitHub Actions, and we have Dockerized multi-git using several Docker commands. Those are all great, but something is still missing: a decent way to tie them all together and use them easily. For example, the GitHubActions pipeline is pretty automatic, but you can’t run it locally. If you want to test something you have to actually commit and push. ...