refactor(): removed redundant files and small improvements

This commit is contained in:
ITQ
2025-12-17 12:15:07 +03:00
parent f9161decb3
commit 7545e7c0d7
17 changed files with 43 additions and 836 deletions
+23 -27
View File
@@ -1,22 +1,24 @@
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build -trimpath -ldflags="-s -w"
GOTEST=$(GOCMD) test
GODOWNLOAD=$(GOCMD) mod download
BINARY_NAME=datarush
MIGRATE_BINARY_NAME=datarush-migrate
BASE_BINARY_NAME=datarush
GW_BINARY_NAME=$(BASE_BINARY_NAME)-gw
MIGRATE_BINARY_NAME=$(BASE_BINARY_NAME)-migrate
AUTH_BINARY_NAME=$(BASE_BINARY_NAME)-auth
BINARY_DIR=bin
# Protobuf parameters
PROTOC=protoc
PROTO_DIR=api/proto
PROTO_FILE=$(PROTO_DIR)/auth.proto $(PROTO_DIR)/competition.proto $(PROTO_DIR)/results.proto $(PROTO_DIR)/review.proto $(PROTO_DIR)/submission.proto $(PROTO_DIR)/task.proto $(PROTO_DIR)/user.proto
PROTO_FILE=${PROTO_DIR}/achievements.proto $(PROTO_DIR)/auth.proto $(PROTO_DIR)/competition.proto $(PROTO_DIR)/results.proto $(PROTO_DIR)/review.proto $(PROTO_DIR)/submission.proto $(PROTO_DIR)/task.proto $(PROTO_DIR)/user.proto
PROTO_OUT=.
.PHONY: install i generate gen generate-gw test build run migrate lint fmt format clean help codegen examples
install:
$(GODOWNLOAD)
$(GOCMD) mod download
$(GOCMD) mod tidy
i: install
@@ -35,16 +37,23 @@ generate-gw:
test:
$(GOTEST) ./...
build:
$(GOBUILD) -o ./$(BINARY_DIR)/$(BINARY_NAME) ./cmd/server
chmod +x ./$(BINARY_DIR)/$(BINARY_NAME)
build-gw:
$(GOBUILD) -o ./$(BINARY_DIR)/$(GW_BINARY_NAME) ./cmd/gw
chmod +x ./$(BINARY_DIR)/$(GW_BINARY_NAME)
build-migrate:
$(GOBUILD) -o ./$(BINARY_DIR)/$(MIGRATE_BINARY_NAME) ./cmd/migrate
chmod +x ./$(BINARY_DIR)/$(MIGRATE_BINARY_NAME)
run: build
./$(BINARY_DIR)/$(BINARY_NAME)
build-auth:
$(GOBUILD) -o ./$(BINARY_DIR)/$(AUTH_BINARY_NAME) ./cmd/auth
chmod +x ./$(BINARY_DIR)/$(AUTH_BINARY_NAME)
build: build-gw build-migrate build-auth
run:
./$(BINARY_DIR)/$(AUTH_BINARY_NAME) &
./$(BINARY_DIR)/$(GW_BINARY_NAME)
migrate: build-migrate
@cmd=$(word 2,$(MAKECMDGOALS)); \
@@ -65,28 +74,15 @@ format: fmt
clean:
rm -rf bin/*
codegen:
@if [ -z "$(SERVICE)" ]; then \
echo "Usage: make codegen SERVICE=<service-name>"; \
echo "Example: make codegen SERVICE=auth"; \
exit 1; \
fi
$(GOBUILD) -o ./$(BINARY_DIR)/codegen ./cmd/codegen
./$(BINARY_DIR)/codegen $(SERVICE) ./
help:
@echo "Available commands:"
@echo "Help:"
@echo " install - Install all deps using go mod download"
@echo " i"
@echo " generate - Generate gRPC code"
@echo " gen"
@echo " protoc"
@echo " codegen - Generate service template"
@echo " Usage: make codegen SERVICE=<name>"
@echo " examples - Show integration examples"
@echo " test - Run tests"
@echo " build - Build the binary"
@echo " build - Build all binaries"
@echo " run - Run the application"
@echo " lint - Run golangci-lint linter"
@echo " format - Run golangci-lint formatter"