dcbot/Makefile

54 lines
1.7 KiB
Makefile

GOOS=$(shell go env GOOS)
GOARCH=$(shell go env GOARCH)
GOBIN=$(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN := $(shell go env GOPATH)/bin
endif
OSARCH=$(shell uname -m)
GOLANGCI_LINT_PATH=$(GOBIN)/golangci-lint
GOOSE_PATH=$(GOBIN)/goose
.PHONY: install-git-hooks
install-git-hooks:
@echo "Installing git hooks..."
pre-commit install --hook-type pre-commit
pre-commit install --hook-type commit-msg
.PHONY: install-golangci-lint
install-golangci-lint:
@echo "Installing github.com/golangci/golangci-lint..."
@(test -f $(GOLANGCI_LINT_PATH) && echo "github.com/golangci/golangci-lint is already installed. Skipping...") || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.55.1
.PHONY: install-counterfeiter
install-counterfeiter:
@echo "Installing github.com/maxbrunsfeld/counterfeiter..."
@go install github.com/maxbrunsfeld/counterfeiter/v6@v6.6.1
.PHONY: install-goose
install-goose:
@echo "Installing github.com/pressly/goose..."
@(test -f $(GOOSE_PATH) && echo "github.com/pressly/goose is already installed. Skipping...") || (wget -q -O $(GOOSE_PATH) https://github.com/pressly/goose/releases/download/v3.15.1/goose_$(GOOS)_$(OSARCH) && chmod u+x $(GOOSE_PATH))
.PHONY: install-tools
install-tools: install-golangci-lint install-counterfeiter install-goose
.PHONY: install
install: install-tools install-git-hooks
.PHONY: generate
generate: install-counterfeiter
go generate ./...
.PHONY: create-sql-migration
create-sql-migration: install-goose
@goose -dir migrations create $(name) sql
.PHONY: validate-migrations
validate-migrations: install-goose
@goose -dir migrations -v validate
.PHONY: validate-translations
validate-translations:
@./validate_translations.sh