|
@@ -1,46 +1,59 @@
|
|
|
-include config/.env
|
|
|
+include .env
|
|
|
|
|
|
-GOOSE_DB_STRING = ${DB_USER}:${DB_PASSWORD}@/${DB_NAME}?parseTime=true
|
|
|
+GOOSE_DB_STRING = "user=${DB_USER} password=${DB_PASSWORD} dbname=${DB_NAME} port=${DB_PORT} host=${DB_HOST} sslmode=disable"
|
|
|
|
|
|
usage:
|
|
|
@echo "make run"
|
|
|
- @echo "make app-build"
|
|
|
- @echo "make lint"
|
|
|
@echo "make test"
|
|
|
@echo "make test-cover"
|
|
|
+ @echo "make lint"
|
|
|
+ @echo "make migration-status"
|
|
|
+ @echo "make migration-up"
|
|
|
+ @echo "make migration-down"
|
|
|
@echo "make docker-build"
|
|
|
@echo "make docker-up"
|
|
|
@echo "make docker-down"
|
|
|
- @echo "make migration-status"
|
|
|
- @echo "make migration-up"
|
|
|
+ @echo "make install-deps"
|
|
|
+ @echo "make app-build"
|
|
|
|
|
|
run:
|
|
|
cd cmd/app && go run main.go
|
|
|
|
|
|
-app-build:
|
|
|
- env GOOS=linux GOARCH=amd64 go build -o build/app/app cmd/app/main.go
|
|
|
+test:
|
|
|
+ go test ./...
|
|
|
+
|
|
|
+test-cover:
|
|
|
+ go test ./... -coverprofile=./coverage.out
|
|
|
+ go tool cover -html=./coverage.out
|
|
|
|
|
|
lint:
|
|
|
golangci-lint run --timeout=3m
|
|
|
|
|
|
-test:
|
|
|
- go test ./...
|
|
|
+migration-status:
|
|
|
+ goose -dir migrations postgres ${GOOSE_DB_STRING} status
|
|
|
|
|
|
-test-cover:
|
|
|
- go test ./... -coverprofile=build/coverage.out
|
|
|
- go tool cover -html=build/coverage.out
|
|
|
+migration-up:
|
|
|
+ goose -dir migrations postgres ${GOOSE_DB_STRING} up
|
|
|
+
|
|
|
+migration-down:
|
|
|
+ goose -dir migrations postgres ${GOOSE_DB_STRING} down
|
|
|
|
|
|
docker-build:
|
|
|
- docker compose --file build/docker/docker-compose.yml --env-file config/.env --project-name dmitriygnatenko up --build --detach
|
|
|
+ docker compose up --build --detach
|
|
|
|
|
|
docker-up:
|
|
|
- docker compose --file build/docker/docker-compose.yml --env-file config/.env --project-name dmitriygnatenko up --detach
|
|
|
+ docker compose up --detach
|
|
|
|
|
|
docker-down:
|
|
|
- docker compose --file build/docker/docker-compose.yml --env-file config/.env --project-name dmitriygnatenko down
|
|
|
+ docker compose down
|
|
|
|
|
|
-migration-status:
|
|
|
- goose -dir migrations mysql ${GOOSE_DB_STRING} status
|
|
|
+install-deps: install-lint install-goose
|
|
|
|
|
|
-migration-up:
|
|
|
- goose -dir migrations mysql ${GOOSE_DB_STRING} up
|
|
|
+install-lint:
|
|
|
+ go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
|
|
+
|
|
|
+install-goose:
|
|
|
+ go install github.com/pressly/goose/v3/cmd/goose@latest
|
|
|
+
|
|
|
+app-build:
|
|
|
+ env GOOS=linux GOARCH=amd64 go build -o build/app/app cmd/app/main.go
|