From 7c294308495745ab68d0883bfdc4f3faba6bc991 Mon Sep 17 00:00:00 2001 From: Sebas Date: Fri, 23 Feb 2024 11:25:59 -0300 Subject: [PATCH] Update README.md --- README.md | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0fc2470..f0c6635 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,75 @@ https://github.com/sebajax/go-vertical-slice-architecture/blob/872df7def565c7e0a https://github.com/sebajax/go-vertical-slice-architecture/blob/eb79ccae805d23b6f77385a5f7ebfc81bb6174e0/pkg/injection/injection.go#L1-L73 -## ⚙️ Usage +## ⚙️ Usage without Make + +### Docker usage + +```bash + # Build server + docker-compose -p go-vertical-slice-architecture build + + # Start server + docker-compose up -d + + # Stop server + docker-compose down +``` + +### Standalone usage + +```bash + # Live reload + air +``` + +### Testing + +```bash + # To run unit testing + go test + + # To run unit testing coverage + go test -cover ./... +``` + +### Formatting, Linting and Vetting + +```bash + # Clean dependencies + go mod tidy + + # Run formating + go fmt ./... + + # Remove unused imports + goimports -l -w . + + # Run linting + golangci-lint run ./... + + # Run vetting + go vet ./... + + # Run shadow to check shadowed variables + # Install shadow + go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest + # Run shadow + shadow ./... +``` + +### Database migration script + +```bash + # Create the script + migrate create -ext sql -dir /migrations -seq [script_name] + # Run the script + migrate -database ${POSTGRESQL_URL} -path /migrations up + + # It will run automatically when the database initializes +``` + +## ⚙️ Usage with Make ### Docker usage