diff --git a/go.work b/go.work new file mode 100644 index 0000000..8c10223 --- /dev/null +++ b/go.work @@ -0,0 +1,6 @@ +go 1.25.4 + +use ( + ./grpc/user/userv1 + ./server +) diff --git a/go.work.sum b/go.work.sum new file mode 100644 index 0000000..9fd6adc --- /dev/null +++ b/go.work.sum @@ -0,0 +1 @@ +google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= diff --git a/grpc b/grpc index 00ebce5..040d4db 160000 --- a/grpc +++ b/grpc @@ -1 +1 @@ -Subproject commit 00ebce5a327bfb43bd3cd8543639671efa99c8cd +Subproject commit 040d4dbacab2cf48ed17d44adcc286d3535d80f1 diff --git a/server/go.mod b/server/go.mod index b3f3a4b..14632b8 100644 --- a/server/go.mod +++ b/server/go.mod @@ -8,7 +8,7 @@ require ( github.com/xuri/excelize/v2 v2.8.1 google.golang.org/grpc v1.60.1 gopkg.in/yaml.v3 v3.0.1 - grpc/user/userv1 v0.0.0 + github.com/grpc/user/userv1 v0.0.0 ) require ( @@ -25,6 +25,3 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect google.golang.org/protobuf v1.32.0 // indirect ) - -// 使用本地 grpc 生成的代码(不修改 grpc 目录) -replace grpc/user/userv1 => ../grpc/user/userv1 diff --git a/server/internal/grpc/user_client.go b/server/internal/grpc/user_client.go index c05fbff..e54937b 100644 --- a/server/internal/grpc/user_client.go +++ b/server/internal/grpc/user_client.go @@ -11,8 +11,8 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/keepalive" - // 使用生成的 proto 代码(通过 go.mod replace 指向本地目录,不修改 grpc 目录) - userv1 "grpc/user/userv1" + // 使用生成的 proto 代码(通过 go.work,不修改 grpc 目录的代码文件) + userv1 "github.com/grpc/user/userv1" ) var (