From 79c780d4b82a40fb740ae87983f9063c4015a933 Mon Sep 17 00:00:00 2001 From: "DESKTOP-V763RJ7\\Administrator" <835606593@qq.com> Date: Sat, 7 Feb 2026 13:15:30 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E5=9F=BA=E7=A1=80=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=8B=86=E5=88=86=E4=B8=BA=E9=9B=AA=E8=8A=B1=E5=92=8C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/app.go | 10 ++++------ go.mod | 2 +- go.sum | 4 ++-- main.go | 4 ++++ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/app.go b/app/app.go index 4a8794f..35fe029 100644 --- a/app/app.go +++ b/app/app.go @@ -16,14 +16,12 @@ type Program struct { } func (p *Program) Init(_ svc.Environment) error { - if err := config.LoadConfig(); err != nil { - return err - } - p.moduleList = append(p.moduleList, &module.Base{Log: config.Get().Log}) + p.moduleList = append(p.moduleList, &module.Log{Cfg: config.Get().Log}) p.moduleList = append(p.moduleList, &module.DB{Cfg: config.Get().DB, AppName: config.Get().App.Name}) + p.moduleList = append(p.moduleList, &module.Snowflake{}) p.moduleList = append(p.moduleList, &module.Grpc{Server: grpc_server.NewServer(config.Get().Serve.Grpc)}) - p.moduleList = append(p.moduleList, &module.Prometheus{MetricCfg: config.Get().Metric}) - p.moduleList = append(p.moduleList, &module.Tracer{MetricCfg: config.Get().Metric, ServiceName: common.KeyDiscoverServiceNameUser}) + p.moduleList = append(p.moduleList, &module.Prometheus{Cfg: config.Get().Metric}) + p.moduleList = append(p.moduleList, &module.Tracer{Cfg: config.Get().Metric, ServiceName: common.KeyDiscoverServiceNameUser}) p.moduleList = append(p.moduleList, &module.Discover{}) for _, m := range p.moduleList { diff --git a/go.mod b/go.mod index 6ddd725..fa888a9 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.hlsq.asia/mmorpg/service-user go 1.24.0 require ( - git.hlsq.asia/mmorpg/service-common v0.0.0-20260206145147-5a0f4b71d430 + git.hlsq.asia/mmorpg/service-common v0.0.0-20260207051302-0ca8a0ccbb14 github.com/judwhite/go-svc v1.2.1 google.golang.org/grpc v1.77.0 gorm.io/gen v0.3.27 diff --git a/go.sum b/go.sum index e206d8e..0813e47 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= -git.hlsq.asia/mmorpg/service-common v0.0.0-20260206145147-5a0f4b71d430 h1:8aNIgKpU6HBg7h4ENjuGWshap+VxeKUmLE0IvFoWbug= -git.hlsq.asia/mmorpg/service-common v0.0.0-20260206145147-5a0f4b71d430/go.mod h1:mMhZcumphj6gaVTppVYsMTkd+5HupmQgAc53Pd4MH9I= +git.hlsq.asia/mmorpg/service-common v0.0.0-20260207051302-0ca8a0ccbb14 h1:4r3tNWRzGVY3Xx6UiGjJJnwoMoWlVqbyGrljxl5d/nQ= +git.hlsq.asia/mmorpg/service-common v0.0.0-20260207051302-0ca8a0ccbb14/go.mod h1:mMhZcumphj6gaVTppVYsMTkd+5HupmQgAc53Pd4MH9I= github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/IBM/sarama v1.46.3 h1:njRsX6jNlnR+ClJ8XmkO+CM4unbrNr/2vB5KK6UA+IE= diff --git a/main.go b/main.go index f88f351..de4dff9 100644 --- a/main.go +++ b/main.go @@ -3,11 +3,15 @@ package main import ( "fmt" "git.hlsq.asia/mmorpg/service-user/app" + "git.hlsq.asia/mmorpg/service-user/config" "github.com/judwhite/go-svc" "syscall" ) func main() { + if err := config.LoadConfig(); err != nil { + fmt.Println(err) + } if err := svc.Run(&app.Program{}, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL); err != nil { fmt.Println(err) }