clean: remove deprecated utils/ package

- Remove all 5 files from utils/ (serial.go, socket.go, pulsar.go,
  sqlite.go, telegram.go)
- cmd/root.go: remove utils import and all utils. references
- cmd/test.go: rewrite to use serial, storage, transport packages directly
  with proper error logging via zap
This commit is contained in:
w1ndyb0y
2026-07-10 15:41:13 +08:00
parent 419f25f0dd
commit 86d473c03d
7 changed files with 29 additions and 499 deletions
+1 -14
View File
@@ -26,7 +26,6 @@ import (
"go.uber.org/zap/zapcore"
"it2000.com.cn/tele-recv/config"
"it2000.com.cn/tele-recv/utils"
)
const ModeName = "TELEGRAM_MODE"
@@ -77,7 +76,6 @@ func init() {
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
initLog()
utils.Log = logger
}
// initConfig reads in config file and ENV variables if set.
@@ -89,7 +87,7 @@ func initConfig() {
}
appCfg = cfg
// Populate legacy globals for backward compatibility
// Populate legacy globals
device = cfg.Serial.Device
baudrate = cfg.Serial.Baudrate
lograw = cfg.Serial.LogRaw
@@ -101,8 +99,6 @@ func initConfig() {
name = cfg.Pulsar.Name
tcp = cfg.Telegram.TCP
pulsar = cfg.Telegram.Pulsar
utils.Tcp = tcp
utils.Pulsar = pulsar
}
func initLog() {
@@ -115,15 +111,6 @@ func initLog() {
panic(err)
}
rawFile := "./logs/raw-%Y-%m-%d-%H.txt"
utils.RawLog, err = rotatelogs.New(
rawFile,
rotatelogs.WithMaxAge(60*24*time.Hour),
rotatelogs.WithRotationTime(time.Hour))
if err != nil {
panic(err)
}
filePriority := zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {
return lvl >= zapcore.DebugLevel
})