💻 Tech
Recently I was introduced to a Mage, an alternative way to do what Make does. I think if the development and build environments get more convoluted and harder to maintain in Makefiles and bash scripts that the Make targets executes, Mage is the way to go. You will use Go to create the targets, and even the tooling itself is created with Go.
Visit Mage repo or the official documentation for more details.
Starting with it is easy if you’re using Go already:
Create the mage binary in your GOPATH directory
git clone https://github.com/magefile/mage
cd mage
go run bootstrap.go
Initialize a new module and create a Go file:
//go:build mage
package main
import "fmt"
// Builds something
func Build() error {
fmt.Println("Under construction, desculpe!")
return nil
}
Run mage -l
to list the available targets and run mage build
to run a specific target:
➜ mage -l
Targets:
build Builds something
➜ mage build
Under construction, desculpe!