Three cheers for mage <https://magefile.org/>. It's more verbose than make but it's pure Go. I use it to build and test projects that include generated html/css/js supported by a Web Assembly clients communicating with a server.
On Monday, August 23, 2021 at 7:33:10 PM UTC-4 Connor Kuehl wrote: > > > > On Aug 22, 2021, at 10:11 PM, jlfo...@berkeley.edu <jlfo...@berkeley.edu> > wrote: > > > > > > I've noticed that few, if any, Go programs use Makefiles. Is that > because the overhead of using make is greater than the overhead of just > always compiling and linking everything? > > One piece of evidence for this is that the Go compiler leaves no > artifacts, like object files, so as is make wouldn't fit into the current > build method. > > > > I started using a Makefile for my Go project so that I could inject a > version string at build time without having to remember what to pass to go > binaries. > > I made a Discord bot to use in a server with my friends, and since I have > some automation in place to automatically deploy the tip of my main branch, > I thought it’d be convenient to be able to ask the bot what build it’s > running so we can see which commits are “live." > > So while it’s not a “traditional” use of make, it certainly is convenient. > > Connor > > P.S., here’s the Makefile. The important bits are the lines that mention > “LD_FLAGS" > > VERSION := v2.2.0+dev > BUILD := $(shell git describe --tags 2>/dev/null || echo "$(VERSION)") > > LD_FLAGS := "-X 'main.Version=$(BUILD)'" > > SOURCES := $(shell find . -type f -name '*.go') > SOURCES += go.mod go.sum > > .PHONY: build clean test > > all: popple > > popple: build > > build: $(SOURCES) > @go build -v -ldflags=$(LD_FLAGS) ./... > > test: popple > @go test -v -ldflags=$(LD_FLAGS) ./... > > clean: > @rm -rf popple -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/6b2116b0-b6e1-4d60-bd88-ee71f011035en%40googlegroups.com.