feat 基础模块拆分为雪花和日志模块

This commit is contained in:
2026-02-07 13:15:29 +08:00
parent 8d28c50c27
commit 3b8378cc72
4 changed files with 8 additions and 7 deletions

View File

@@ -14,10 +14,7 @@ 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, &ModuleWebsocket{})
p.moduleList = append(p.moduleList, &ModulePprof{})

2
go.mod
View File

@@ -3,7 +3,7 @@ module git.hlsq.asia/mmorpg/service-robot
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/gorilla/websocket v1.5.3
github.com/judwhite/go-svc v1.2.1
google.golang.org/protobuf v1.36.10

4
go.sum
View File

@@ -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=

View File

@@ -3,11 +3,15 @@ package main
import (
"fmt"
"git.hlsq.asia/mmorpg/service-robot/app"
"git.hlsq.asia/mmorpg/service-robot/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)
}