mirror of https://github.com/milvus-io/milvus.git
[skip ci] Fix golint error in proxy (#9283)
Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>pull/9287/head
parent
809129ba63
commit
6cf049130d
|
@ -23,6 +23,8 @@ import (
|
|||
"github.com/milvus-io/milvus/internal/util/paramtable"
|
||||
)
|
||||
|
||||
// ParamTable is a derived struct of paramtable.BaseTable. It achieves Composition by
|
||||
// embedding paramtable.BaseTable. It is used to quickly and easily access the system configuration.
|
||||
type ParamTable struct {
|
||||
paramtable.BaseTable
|
||||
|
||||
|
@ -39,16 +41,19 @@ type ParamTable struct {
|
|||
ServerMaxRecvSize int
|
||||
}
|
||||
|
||||
// Params is a package scoped variable of type ParamTable.
|
||||
var Params ParamTable
|
||||
var once sync.Once
|
||||
|
||||
// Init is an override method of BaseTable's Init. It mainly calls the
|
||||
// Init of BaseTable and do some other initialization.
|
||||
func (pt *ParamTable) Init() {
|
||||
once.Do(func() {
|
||||
pt.BaseTable.Init()
|
||||
pt.initParams()
|
||||
|
||||
pt.LoadFromEnv()
|
||||
pt.LoadFromArgs()
|
||||
pt.loadFromEnv()
|
||||
pt.loadFromArgs()
|
||||
pt.Address = pt.IP + ":" + strconv.FormatInt(int64(pt.Port), 10)
|
||||
|
||||
pt.initServerMaxSendSize()
|
||||
|
@ -56,11 +61,11 @@ func (pt *ParamTable) Init() {
|
|||
})
|
||||
}
|
||||
|
||||
func (pt *ParamTable) LoadFromArgs() {
|
||||
func (pt *ParamTable) loadFromArgs() {
|
||||
|
||||
}
|
||||
|
||||
func (pt *ParamTable) LoadFromEnv() {
|
||||
func (pt *ParamTable) loadFromEnv() {
|
||||
Params.IP = funcutil.GetLocalIP()
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,6 @@ func TestParamTable(t *testing.T) {
|
|||
Params.initServerMaxRecvSize()
|
||||
assert.Equal(t, Params.ServerMaxRecvSize, grpcconfigs.DefaultServerMaxRecvSize)
|
||||
|
||||
Params.LoadFromEnv()
|
||||
Params.loadFromEnv()
|
||||
assert.Equal(t, Params.IP, funcutil.GetLocalIP())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue