Files
reddit-go/Makefile
T
guy176251 519f3f4f00 Added surf http client
- updated Makefile
- updated dependencies
2026-01-24 15:16:51 -06:00

42 lines
868 B
Makefile

ROOT_PKG ?= "github.com/vartanbeno/go-reddit"
LIST_PKG := $(shell go list $(ROOT_PKG)/...)
# Tests
TEST_TIMEOUT ?= 20
.DEFAULT_GOAL := usage
# Print colorized log
define log
echo "[$(@)] $(1)"
endef
.PHONY: all
all: fmt vet test test-coverage
.PHONY: usage
usage:
@echo "make [all|fmt|vet|test|test-coverage]"
.PHONY: fmt
fmt:
@$(call log,"Running formatter")
@go fmt $(LIST_PKG)
.PHONY: vet
vet:
@$(call log,"Running vet")
@go vet -all $(LIST_PKG)
.PHONY: test
test: fmt vet
@$(call log,"Running tests")
@go test -v -race -short -timeout $(TEST_TIMEOUT)s $(ARGS) $(LIST_PKG)
.PHONY: test-coverage
test-coverage: fmt vet
@$(call log,"Running tests with coverage")
@go test -v -race -short -timeout $(TEST_TIMEOUT)s $(ARGS) -coverprofile=coverage.out $(LIST_PKG)
@go tool cover -func=coverage.out
@go tool cover -html=coverage.out -o coverage.html