go-zero
go-zero copied to clipboard
defines the method to customize http server
单体服务部署时需要支持热更新,一些开源方案如overseer等需要使用http Serve,gozero的internal.StartHttp是支持StartOption的,但是Server Start不支持设置,发起pr支持start时自定义StartOption
It doesn't work, because Start(...StartOption)
doesn't meet the Service
interface.
So the server cannot be added into a ServiceGroup
.
I think you can use RunOption
to achieve that.
It doesn't work, because
Start(...StartOption)
doesn't meet theService
interface.So the server cannot be added into a
ServiceGroup
.I think you can use
RunOption
to achieve that.
不能用RunOption, server.Start时才创建了http.Server, rest.RunOption在MustNewServer的时候就调用了; 需求是让api的http server能接受另一个 net.Listener, 类似 svr.ListenAndServe要Serve一下
Would you please add unit tests?
Codecov Report
Merging #2171 (4e1c957) into master (211b949) will decrease coverage by
0.07%
. The diff coverage is26.66%
.
Impacted Files | Coverage Δ | |
---|---|---|
rest/engine.go | 92.07% <11.11%> (-1.24%) |
:arrow_down: |
rest/server.go | 94.85% <50.00%> (-1.64%) |
:arrow_down: |