This commit is contained in:
2024-04-20 16:45:56 +03:00
commit 937c8d8eab
34 changed files with 3048 additions and 0 deletions

34
Makefile Normal file
View File

@@ -0,0 +1,34 @@
#!make
PROJECT_NAME=gerald
spec_path = ./api/$(PROJECT_NAME).yaml
models_pkg = $(PROJECT_NAME)/internal/interfaces/rest/models
build:
CGO_ENABLED=0 go build -o ./dist/$(PROJECT_NAME) $(PROJECT_NAME)/cmd
generate:
rm -rf ./internal/interfaces/rest/models/*
rm -rf ./internal/interfaces/rest/restapi/operations
# download go-swagger in not exist
go get github.com/go-swagger/go-swagger/cmd/swagger
# generate swagger models and server handlers
go run github.com/go-swagger/go-swagger/cmd/swagger generate model --spec=$(spec_path) --target=./internal/interfaces/rest
go run github.com/go-swagger/go-swagger/cmd/swagger generate server --skip-models --existing-models=$(models_pkg) --exclude-main --spec=$(spec_path) --target=./internal/interfaces/rest
# clean up the generated files
rm -rf ./gen
go mod tidy
serve:
./dist/$(PROJECT_NAME)
test:
go test -v ./...
lint:
go fmt ./...
golangci-lint run ./... --timeout 5m0s -v
run: build serve
r: build serve