diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5a40405 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +[*] +indent_style = tab +indent_size = 4 + +[*.yml] +indent_style = space +indent_size = 2 + +[*.yaml] +indent_style = space +indent_size = 2 + +[Makefile] +indent_style = tab +indent_size = 4 diff --git a/cmd/helpers/projectHelper.go b/cmd/helpers/projectHelper.go index 2da2ec3..17779a9 100644 --- a/cmd/helpers/projectHelper.go +++ b/cmd/helpers/projectHelper.go @@ -30,6 +30,7 @@ func (h *projectHelper) InitProject(project models.Project) error { {TemplatePath: "templates/Makefile.tmpl", Destination: "/Makefile"}, {TemplatePath: "templates/go.tmpl", Destination: "/go.mod"}, {TemplatePath: "templates/main.tmpl", Destination: "/main.go"}, + {TemplatePath: "templates/editorconfig.tmpl", Destination: "/.editorconfig"}, {TemplatePath: "templates/instance/instance.tmpl", Destination: "/instance/instance.go"}, {TemplatePath: "templates/app/init.tmpl", Destination: "/app/init.go"}, } @@ -110,7 +111,7 @@ func (h *projectHelper) CreategRPCAPI(project models.Project) error { {TemplatePath: "templates/app/grpc/handlers/health.tmpl", Destination: "/app/grpc/handlers/health.go"}, {TemplatePath: "templates/app/grpc/proto/health.proto", Destination: "/app/grpc/proto/health.proto"}, {TemplatePath: "templates/app/grpc/proto/health.pb.tmpl", Destination: "/app/grpc/proto/health.pb.go"}, - {TemplatePath: "templates/app/grpc/proto/health_grpc.pb.tmpl", Destination: "/app/grpc/proto/health_hrpc.pb.go"}, + {TemplatePath: "templates/app/grpc/proto/health_grpc.pb.tmpl", Destination: "/app/grpc/proto/health_grpc.pb.go"}, {TemplatePath: "templates/app/grpc/router/router.tmpl", Destination: "/app/grpc/router/router.go"}, {TemplatePath: "templates/runner/grpc.tmpl", Destination: "/runner/grpc.go"}, } diff --git a/templates/Makefile.tmpl b/templates/Makefile.tmpl index 83e449d..b19df36 100644 --- a/templates/Makefile.tmpl +++ b/templates/Makefile.tmpl @@ -9,6 +9,16 @@ endif test: go test -v ./... -race -coverprofile=coverage.out -covermode=atomic +coverage: test + go tool cover -func=coverage.out + +coverage-html: test + mkdir -p coverage + go tool cover -html=coverage.out -o coverage/index.html + +coverage-serve: coverage-html + python3 -m http.server 8080 -d coverage + setup: go mod tidy diff --git a/templates/docker/Dockerfile.debug b/templates/docker/Dockerfile.debug index e737cbd..4bfee8f 100644 --- a/templates/docker/Dockerfile.debug +++ b/templates/docker/Dockerfile.debug @@ -38,4 +38,6 @@ RUN set -x && \ WORKDIR /app +RUN go install github.com/go-delve/delve/cmd/dlv@latest + ENTRYPOINT ["modd", "-f", "./docker/modd-debug.conf"] diff --git a/templates/docker/modd-debug.conf b/templates/docker/modd-debug.conf index a297a7a..75b780f 100644 --- a/templates/docker/modd-debug.conf +++ b/templates/docker/modd-debug.conf @@ -3,7 +3,7 @@ prep: if pgrep $APP_NAME; then pkill $APP_NAME; fi prep: if pgrep dlv; then pkill dlv; fi prep: go mod tidy - prep: go build -gcflags="-N -l" -o $APP_NAME ./*.go + prep: go build -gcflags="all=-N -l" -o $APP_NAME ./*.go daemon: ./$APP_NAME start - daemon: dlv attach --headless=true --listen=:2345 --api-version=2 $(pidof $BIN_NAME) + daemon: dlv attach --headless=true --listen=:2345 --api-version=2 $(pidof $APP_NAME) } diff --git a/templates/editorconfig.tmpl b/templates/editorconfig.tmpl new file mode 100644 index 0000000..5a40405 --- /dev/null +++ b/templates/editorconfig.tmpl @@ -0,0 +1,15 @@ +[*] +indent_style = tab +indent_size = 4 + +[*.yml] +indent_style = space +indent_size = 2 + +[*.yaml] +indent_style = space +indent_size = 2 + +[Makefile] +indent_style = tab +indent_size = 4 diff --git a/templates/gitignore.tmpl b/templates/gitignore.tmpl index a51d3b0..aea1ab9 100644 --- a/templates/gitignore.tmpl +++ b/templates/gitignore.tmpl @@ -1,5 +1,10 @@ +# Files {{.AppName}} {{.AppName}}.exe .env .db -modd/ \ No newline at end of file +coverage.out + + +# Directory +coverage/