We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在初始化服务器的时候,如果在同一台服务器初始化了两个server,例如下所示,
func TestTwoServer(t *testing.T){ fmt.Println("server Test") _ = NewServer() t.Log(zconf.GlobalObject) _ = NewDefaultRouterSlicesServer() t.Log(zconf.GlobalObject) }
第一个server的routerslice为false,第二个server为true 可是如果调换了顺序
func TestTwoServerReversed(t *testing.T){ fmt.Println("server Test") _ = NewDefaultRouterSlicesServer() t.Log(zconf.GlobalObject) _ = NewServer() t.Log(zconf.GlobalObject) } 两个都为true,不符合初始化的想法,主要原因是,server.go的148行代码,zconf.GlobalObject是一个指针变量
func NewDefaultRouterSlicesServer(opts ...Option) ziface.IServer { zconf.GlobalObject.RouterSlicesMode = true s := newServerWithConfig(zconf.GlobalObject, "tcp", opts...) s.Use(RouterRecovery) return s }
The text was updated successfully, but these errors were encountered:
目前暂时不支持这种写法,不过全局一个Config 这块确实应该改进下,改成Config是一个Server的属性。这块在等待有人提PR,或者今后改进。这个问题就不存在了
Sorry, something went wrong.
No branches or pull requests
在初始化服务器的时候,如果在同一台服务器初始化了两个server,例如下所示,
func TestTwoServer(t *testing.T){
fmt.Println("server Test")
_ = NewServer()
t.Log(zconf.GlobalObject)
_ = NewDefaultRouterSlicesServer()
t.Log(zconf.GlobalObject)
}
第一个server的routerslice为false,第二个server为true
可是如果调换了顺序
func TestTwoServerReversed(t *testing.T){
fmt.Println("server Test")
_ = NewDefaultRouterSlicesServer()
t.Log(zconf.GlobalObject)
_ = NewServer()
t.Log(zconf.GlobalObject)
}
两个都为true,不符合初始化的想法,主要原因是,server.go的148行代码,zconf.GlobalObject是一个指针变量
func NewDefaultRouterSlicesServer(opts ...Option) ziface.IServer {
zconf.GlobalObject.RouterSlicesMode = true
s := newServerWithConfig(zconf.GlobalObject, "tcp", opts...)
s.Use(RouterRecovery)
return s
}
The text was updated successfully, but these errors were encountered: