apply go-centric architecture optimizations and document them in readme

This commit is contained in:
DBT
2026-02-24 09:25:12 +00:00
parent 3dd918d429
commit 4105eeb0db
7 changed files with 209 additions and 12 deletions

View File

@@ -0,0 +1,25 @@
package runtimecfg
import (
"sync/atomic"
"clawgo/pkg/config"
)
var current atomic.Value // *config.Config
func Set(cfg *config.Config) {
if cfg == nil {
return
}
current.Store(cfg)
}
func Get() *config.Config {
v := current.Load()
if v == nil {
return nil
}
cfg, _ := v.(*config.Config)
return cfg
}