From 9cdeb74ee5fe6e738d2bb92d7cef6a579059cf7c Mon Sep 17 00:00:00 2001 From: jacexh Date: Mon, 22 Mar 2021 17:02:26 +0800 Subject: [PATCH] update --- Dockerfile | 6 +++--- api/middleware/ginzap.go | 4 ++-- api/middleware/index.go | 2 +- api/middleware/recovery.go | 2 +- api/server.go | 8 ++++---- api/v1/api.go | 6 +++--- cmd/main.go | 12 ++++++------ go.mod | 2 +- internal/application/converter.go | 4 ++-- internal/application/handler/user.go | 8 ++++---- internal/application/user.go | 12 ++++++------ internal/domain/event/mediator.go | 4 ++-- internal/domain/user/event.go | 2 +- internal/domain/user/user.go | 2 +- internal/infrastructure/persistence/converter.go | 4 ++-- internal/infrastructure/persistence/database.go | 4 ++-- internal/infrastructure/persistence/user.go | 2 +- internal/logger/logger.go | 2 +- internal/logger/xorm.go | 2 +- internal/trace/context.go | 2 +- internal/trace/zap.go | 2 +- 21 files changed, 46 insertions(+), 46 deletions(-) diff --git a/Dockerfile b/Dockerfile index 695084a..5f1b6de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,12 +9,12 @@ RUN set -e \ && apt update -y \ && apt install -y git \ && REVISION=`git rev-list -1 HEAD` \ - && go build -ldflags "-X main.version=$REVISION" -o app -tags=jsoniter cmd/main.go + && go build -ldflags "-X main.version=$REVISION" -o {{.BinFile}} -tags=jsoniter cmd/main.go FROM debian:buster WORKDIR /app VOLUME /app/conf -COPY --from=builder /go/src/app . +COPY --from=builder /go/src/{{.BinFile}} . COPY --from=builder /go/src/conf/* ./conf/ RUN set -e \ && sed -i "s/deb.debian.org/mirrors.aliyun.com/g" /etc/apt/sources.list \ @@ -25,4 +25,4 @@ RUN set -e \ && apt autoremove -yqq \ && rm -rf /var/lib/apt/lists/* EXPOSE 8080 -CMD ["/app/app"] \ No newline at end of file +CMD ["/app/{{.BinFile}}"] \ No newline at end of file diff --git a/api/middleware/ginzap.go b/api/middleware/ginzap.go index a5b42c7..bf92d25 100644 --- a/api/middleware/ginzap.go +++ b/api/middleware/ginzap.go @@ -5,8 +5,8 @@ import ( "time" "github.com/gin-gonic/gin" - "github.com/jacexh/golang-ddd-template/internal/trace" - "github.com/jacexh/golang-ddd-template/pkg/bytespool" + "{{.Module}}/internal/trace" + "{{.Module}}/pkg/bytespool" "go.uber.org/zap" ) diff --git a/api/middleware/index.go b/api/middleware/index.go index 7043ee6..940c242 100644 --- a/api/middleware/index.go +++ b/api/middleware/index.go @@ -5,7 +5,7 @@ import ( "sync/atomic" "github.com/gin-gonic/gin" - "github.com/jacexh/golang-ddd-template/internal/trace" + "{{.Module}}/internal/trace" ) type ( diff --git a/api/middleware/recovery.go b/api/middleware/recovery.go index 346ea33..de9e407 100644 --- a/api/middleware/recovery.go +++ b/api/middleware/recovery.go @@ -9,7 +9,7 @@ import ( "strings" "github.com/gin-gonic/gin" - "github.com/jacexh/golang-ddd-template/internal/trace" + "{{.Module}}/internal/trace" "go.uber.org/zap" ) diff --git a/api/server.go b/api/server.go index c0d023d..dc6e71e 100644 --- a/api/server.go +++ b/api/server.go @@ -4,10 +4,10 @@ import ( "net/http" "github.com/gin-gonic/gin" - "github.com/jacexh/golang-ddd-template/api/middleware" - v1 "github.com/jacexh/golang-ddd-template/api/v1" - "github.com/jacexh/golang-ddd-template/internal/logger" - "github.com/jacexh/golang-ddd-template/internal/option" + "{{.Module}}/api/middleware" + v1 "{{.Module}}/api/v1" + "{{.Module}}/internal/logger" + "{{.Module}}/internal/option" ) // BuildRouter 构造Router diff --git a/api/v1/api.go b/api/v1/api.go index 3a6a073..399f491 100644 --- a/api/v1/api.go +++ b/api/v1/api.go @@ -4,9 +4,9 @@ import ( "net/http" "github.com/gin-gonic/gin" - "github.com/jacexh/golang-ddd-template/api/dto" - "github.com/jacexh/golang-ddd-template/internal/application" - "github.com/jacexh/golang-ddd-template/internal/trace" + "{{.Module}}/api/dto" + "{{.Module}}/internal/application" + "{{.Module}}/internal/trace" ) func CreateUser(c *gin.Context) { diff --git a/cmd/main.go b/cmd/main.go index ff21e26..853eb4e 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -9,12 +9,12 @@ import ( "syscall" "time" - "github.com/jacexh/golang-ddd-template/api" - "github.com/jacexh/golang-ddd-template/internal/application" - "github.com/jacexh/golang-ddd-template/internal/infrastructure/persistence" - "github.com/jacexh/golang-ddd-template/internal/logger" - "github.com/jacexh/golang-ddd-template/internal/option" - "github.com/jacexh/golang-ddd-template/pkg/infection" + "{{.Module}}/api" + "{{.Module}}/internal/application" + "{{.Module}}/internal/infrastructure/persistence" + "{{.Module}}/internal/logger" + "{{.Module}}/internal/option" + "{{.Module}}/pkg/infection" "go.uber.org/zap" ) diff --git a/go.mod b/go.mod index c853d1b..89fdeda 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/jacexh/golang-ddd-template +module {{.Module}} go 1.14 diff --git a/internal/application/converter.go b/internal/application/converter.go index 39059f5..26276d7 100644 --- a/internal/application/converter.go +++ b/internal/application/converter.go @@ -1,8 +1,8 @@ package application import ( - "github.com/jacexh/golang-ddd-template/api/dto" - "github.com/jacexh/golang-ddd-template/internal/domain/user" + "{{.Module}}/api/dto" + "{{.Module}}/internal/domain/user" ) func convertUser(user *user.UserEntity) *dto.UserDTO { diff --git a/internal/application/handler/user.go b/internal/application/handler/user.go index baee442..9aa3b44 100644 --- a/internal/application/handler/user.go +++ b/internal/application/handler/user.go @@ -3,10 +3,10 @@ package handler import ( "context" - "github.com/jacexh/golang-ddd-template/internal/domain/event" - "github.com/jacexh/golang-ddd-template/internal/domain/user" - "github.com/jacexh/golang-ddd-template/internal/logger" - "github.com/jacexh/golang-ddd-template/internal/trace" + "{{.Module}}/internal/domain/event" + "{{.Module}}/internal/domain/user" + "{{.Module}}/internal/logger" + "{{.Module}}/internal/trace" "go.uber.org/zap" ) diff --git a/internal/application/user.go b/internal/application/user.go index 35d3fee..0d9cc3f 100644 --- a/internal/application/user.go +++ b/internal/application/user.go @@ -3,12 +3,12 @@ package application import ( "context" - "github.com/jacexh/golang-ddd-template/api/dto" - "github.com/jacexh/golang-ddd-template/internal/application/handler" - "github.com/jacexh/golang-ddd-template/internal/domain/event" - "github.com/jacexh/golang-ddd-template/internal/domain/user" - "github.com/jacexh/golang-ddd-template/internal/logger" - "github.com/jacexh/golang-ddd-template/internal/trace" + "{{.Module}}/api/dto" + "{{.Module}}/internal/application/handler" + "{{.Module}}/internal/domain/event" + "{{.Module}}/internal/domain/user" + "{{.Module}}/internal/logger" + "{{.Module}}/internal/trace" "go.uber.org/zap" ) diff --git a/internal/domain/event/mediator.go b/internal/domain/event/mediator.go index c30cfa7..3bc464b 100644 --- a/internal/domain/event/mediator.go +++ b/internal/domain/event/mediator.go @@ -3,8 +3,8 @@ package event import ( "context" - "github.com/jacexh/golang-ddd-template/internal/logger" - "github.com/jacexh/golang-ddd-template/internal/trace" + "{{.Module}}/internal/logger" + "{{.Module}}/internal/trace" "go.uber.org/zap" ) diff --git a/internal/domain/user/event.go b/internal/domain/user/event.go index 399b90e..5c4b4e8 100644 --- a/internal/domain/user/event.go +++ b/internal/domain/user/event.go @@ -1,6 +1,6 @@ package user -import "github.com/jacexh/golang-ddd-template/internal/domain/event" +import "{{.Module}}/internal/domain/event" type ( EventUserCreated struct { diff --git a/internal/domain/user/user.go b/internal/domain/user/user.go index 69ad4e6..7e0247b 100644 --- a/internal/domain/user/user.go +++ b/internal/domain/user/user.go @@ -3,7 +3,7 @@ package user import ( "errors" - "github.com/jacexh/golang-ddd-template/internal/domain/event" + "{{.Module}}/internal/domain/event" ) type UserEntity struct { diff --git a/internal/infrastructure/persistence/converter.go b/internal/infrastructure/persistence/converter.go index 12739bb..7abe0c9 100644 --- a/internal/infrastructure/persistence/converter.go +++ b/internal/infrastructure/persistence/converter.go @@ -1,8 +1,8 @@ package persistence import ( - "github.com/jacexh/golang-ddd-template/internal/domain/user" - "github.com/jacexh/golang-ddd-template/internal/infrastructure/do" + "{{.Module}}/internal/domain/user" + "{{.Module}}/internal/infrastructure/do" ) func convertUser(entity *user.UserEntity) *do.UserDo { diff --git a/internal/infrastructure/persistence/database.go b/internal/infrastructure/persistence/database.go index 7cb8f26..0bf490a 100644 --- a/internal/infrastructure/persistence/database.go +++ b/internal/infrastructure/persistence/database.go @@ -4,8 +4,8 @@ import ( "fmt" _ "github.com/go-sql-driver/mysql" - "github.com/jacexh/golang-ddd-template/internal/logger" - "github.com/jacexh/golang-ddd-template/internal/option" + "{{.Module}}/internal/logger" + "{{.Module}}/internal/option" "go.uber.org/zap" "xorm.io/xorm" ) diff --git a/internal/infrastructure/persistence/user.go b/internal/infrastructure/persistence/user.go index 61a922d..1900005 100644 --- a/internal/infrastructure/persistence/user.go +++ b/internal/infrastructure/persistence/user.go @@ -3,7 +3,7 @@ package persistence import ( "context" - "github.com/jacexh/golang-ddd-template/internal/domain/user" + "{{.Module}}/internal/domain/user" "xorm.io/xorm" ) diff --git a/internal/logger/logger.go b/internal/logger/logger.go index 3066623..fcc4229 100644 --- a/internal/logger/logger.go +++ b/internal/logger/logger.go @@ -1,7 +1,7 @@ package logger import ( - "github.com/jacexh/golang-ddd-template/internal/option" + "{{.Module}}/internal/option" "github.com/jacexh/goutil/zaphelper" "go.uber.org/zap" "go.uber.org/zap/zapcore" diff --git a/internal/logger/xorm.go b/internal/logger/xorm.go index d13b095..3a19541 100644 --- a/internal/logger/xorm.go +++ b/internal/logger/xorm.go @@ -3,7 +3,7 @@ package logger import ( "fmt" - "github.com/jacexh/golang-ddd-template/internal/trace" + "{{.Module}}/internal/trace" "go.uber.org/zap" "go.uber.org/zap/zapcore" "xorm.io/xorm/log" diff --git a/internal/trace/context.go b/internal/trace/context.go index 7713cd2..5df664c 100644 --- a/internal/trace/context.go +++ b/internal/trace/context.go @@ -4,7 +4,7 @@ import ( "context" "github.com/gin-gonic/gin" - "github.com/jacexh/golang-ddd-template/pkg/infection" + "{{.Module}}/pkg/infection" ) const ( diff --git a/internal/trace/zap.go b/internal/trace/zap.go index 88153c9..2897e01 100644 --- a/internal/trace/zap.go +++ b/internal/trace/zap.go @@ -4,7 +4,7 @@ import ( "context" "github.com/gin-gonic/gin" - "github.com/jacexh/golang-ddd-template/pkg/infection" + "{{.Module}}/pkg/infection" "go.uber.org/zap" )