init project

This commit is contained in:
admin committed 2026-11-11 17:49:38 +08:00
1 parent aee8bcc886
commit a82a843b76
9 files changed
+20 -11

No files matched your search

+1
View File
@@ -3,3 +3,4 @@
.env
.env.local
.DS_Store
*.local.yaml
+7 -3
View File
@@ -1,10 +1,14 @@
FROM golang:1.27.3-alpine AS builder
RUN apk add --no-cache git openssh-client
ENV GOPRIVATE=git.vitatech.com.cn
RUN git config --global url."ssh://git@git.vitatech.com.cn:12222/".insteadOf "https://git.vitatech.com.cn/" \
&& mkdir -p -m 0700 /root/.ssh
WORKDIR /src
COPY proto/go.mod proto/go.sum ./proto/
COPY gin_layout/go.mod gin_layout/go.sum ./gin_layout/
WORKDIR /src/gin_layout
RUN go mod download
COPY proto /src/proto
RUN --mount=type=ssh,required=true \
--mount=type=secret,id=git_known_hosts,target=/root/.ssh/known_hosts,required=true \
go mod download
COPY gin_layout /src/gin_layout
RUN CGO_ENABLED=0 go build -trimpath -o /out/api ./cmd/api
+3 -2
View File
@@ -38,8 +38,9 @@ service 接收标准库 `context.Context`,不依赖 Gin。
在项目根目录执行:
本项目通过本地 `../proto` 模块调用 `../micro_layout`,请先按[父目录 README](../README.md)
启动 etcd 和 Micro。三个目录需要保持同级。
本项目通过远程模块 `git.vitatech.com.cn/leo/proto.git` 调用 Micro,无需克隆 proto。
先按 proto 仓库的 README
配置私有模块和 SSH,再按[父目录 README](../README.md)启动 etcd 和 Micro。
```sh
go mod download
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"strconv"
"syscall"
"example.com/layout/proto/micro_layout/client"
"git.vitatech.com.cn/leo/proto.git/micro_layout/client"
"gin_layout/internal/config"
"gin_layout/internal/router"
+3
View File
@@ -2,6 +2,9 @@ app:
name: gin_layout
env: local
auth:
token: "local-dev-token"
server:
port: 8080
mode: debug
+1 -3
View File
@@ -2,10 +2,8 @@ module gin_layout
go 1.27.3
replace example.com/layout/proto => ../proto
require (
example.com/layout/proto v0.0.0
git.vitatech.com.cn/leo/proto.git v0.0.0-20261111072135-44f7964733ab
github.com/gin-gonic/gin v1.12.0
github.com/spf13/viper v1.21.0
google.golang.org/grpc v1.85.0
+2
View File
@@ -1,3 +1,5 @@
git.vitatech.com.cn/leo/proto.git v0.0.0-20261111072135-44f7964733ab h1:mpsW3H4YwNEx0HJxNa2UPIt1Ds4P+PpVgSJtPrOV4WQ=
git.vitatech.com.cn/leo/proto.git v0.0.0-20261111072135-44f7964733ab/go.mod h1:KHJCeohHC1l3iVDq/IbmN85OqcqY8fS2LV9MKP4jPi8=
github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
github.com/bytedance/sonic v1.15.0 h1:/PXeWFaR5ElNcVE84U0dOHjiMHQOwNIx3K4ymzh/uSE=
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"strings"
"time"
"example.com/layout/proto/discovery"
"git.vitatech.com.cn/leo/proto.git/discovery"
"github.com/spf13/viper"
)
+1 -1
View File
@@ -5,8 +5,8 @@ import (
"errors"
"time"
"example.com/layout/proto/micro_layout/proto/user"
"gin_layout/enum"
"git.vitatech.com.cn/leo/proto.git/micro_layout/proto/user"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"