2023-04-30 04:17:59 +00:00
|
|
|
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
|
2023-06-09 06:32:46 +00:00
|
|
|
GOOSE_PATH=$(GOBIN)/goose
|
2022-10-09 06:31:38 +00:00
|
|
|
|
2022-10-02 05:22:00 +00:00
|
|
|
.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..."
|
2024-04-30 08:16:55 +00:00
|
|
|
@(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.57.2
|
2022-10-02 05:22:00 +00:00
|
|
|
|
2022-10-09 06:31:38 +00:00
|
|
|
.PHONY: install-counterfeiter
|
|
|
|
install-counterfeiter:
|
|
|
|
@echo "Installing github.com/maxbrunsfeld/counterfeiter..."
|
2024-04-30 08:16:55 +00:00
|
|
|
@go install github.com/maxbrunsfeld/counterfeiter/v6@v6.8.1
|
2022-10-09 06:31:38 +00:00
|
|
|
|
2023-06-09 06:32:46 +00:00
|
|
|
.PHONY: install-goose
|
|
|
|
install-goose:
|
|
|
|
@echo "Installing github.com/pressly/goose..."
|
2024-04-30 08:16:55 +00:00
|
|
|
@(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.20.0/goose_$(GOOS)_$(OSARCH) && chmod u+x $(GOOSE_PATH))
|
2023-06-09 06:32:46 +00:00
|
|
|
|
2024-05-02 05:57:24 +00:00
|
|
|
.PHONY: install-oapi-codegen
|
|
|
|
install-oapi-codegen:
|
|
|
|
@echo "Installing github.com/deepmap/oapi-codegen..."
|
|
|
|
@go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@v2.1.0
|
|
|
|
|
2023-06-09 06:32:46 +00:00
|
|
|
|
2022-10-02 05:22:00 +00:00
|
|
|
.PHONY: install-tools
|
2023-06-09 06:32:46 +00:00
|
|
|
install-tools: install-golangci-lint install-counterfeiter install-goose
|
2022-10-02 05:22:00 +00:00
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install: install-tools install-git-hooks
|
2022-10-02 06:29:23 +00:00
|
|
|
|
2022-10-09 06:31:38 +00:00
|
|
|
.PHONY: generate
|
2024-05-02 05:57:24 +00:00
|
|
|
generate: install-counterfeiter install-oapi-codegen
|
2023-04-30 04:17:59 +00:00
|
|
|
go generate ./...
|
2023-06-09 06:32:46 +00:00
|
|
|
|
|
|
|
.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
|
2023-06-25 07:17:37 +00:00
|
|
|
|
|
|
|
.PHONY: validate-translations
|
|
|
|
validate-translations:
|
|
|
|
@./validate_translations.sh
|