Last active
March 21, 2022 00:45
-
-
Save whitekid/0d337b36901ab3130ea60c433e2f0351 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TARGET=bin/<your-target> | |
GO_PKG=<your-module-name> | |
SRC=$(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "*_test.go") | |
GO?=go | |
BUILD_FLAGS?=-v | |
.PHONY: clean test dep tidy | |
all: build | |
build: $(TARGET) | |
$(TARGET): $(SRC) | |
@mkdir -p ${TARGET} | |
${GO} build -o bin/ ${BUILD_FLAGS} ./cmd/... | |
clean: | |
rm -f ${TARGET} | |
test: | |
${GO} test ./... --count=1 | |
# update modules & tidy | |
dep: | |
rm -f go.mod go.sum | |
${GO} mod init ${GO_PKG} | |
@$(MAKE) tidy | |
tidy: | |
${GO} mod tidy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "build", | |
"type": "shell", | |
"command": "make", | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment