fix index slice append

This commit is contained in:
710leo 2020-04-14 16:02:08 +08:00
parent c59cb74f12
commit 56f8241ea5
5 changed files with 7 additions and 7 deletions

View File

@ -244,7 +244,7 @@ func IndexList() []*model.Instance {
return []*model.Instance{}
}
instances := make([]*model.Instance, len(activeIndexes))
var instances []*model.Instance
for _, instance := range activeIndexes {
if instance.Identity != identity.Identity {
instances = append(instances, instance)

View File

@ -107,7 +107,7 @@ func (m *MetricIndexMap) GetMetrics() []string {
m.RLock()
defer m.RUnlock()
metrics := make([]string, len(m.Data))
var metrics []string
for k := range m.Data {
metrics = append(metrics, k)
}

View File

@ -30,9 +30,9 @@ func (t *TagkvIndex) GetTagkv() []*TagPair {
t.RLock()
defer t.RUnlock()
tagkvs := make([]*TagPair, len(t.Tagkv))
var tagkvs []*TagPair
for k, vm := range t.Tagkv {
vs := make([]string, len(vm))
var vs []string
for v := range vm {
vs = append(vs, v)
}
@ -52,7 +52,7 @@ func (t *TagkvIndex) GetTagkvMap() map[string][]string {
tagkvs := make(map[string][]string)
for k, vm := range t.Tagkv {
vs := make([]string, len(vm))
var vs []string
for v := range vm {
vs = append(vs, v)
}

View File

@ -123,7 +123,7 @@ func GetTagPairs(c *gin.Context) {
}
for tagk, tagvFilter := range tagkvFilter {
tagvs := make([]string, len(tagvFilter))
var tagvs []string
for v := range tagvFilter {
tagvs = append(tagvs, v)
}

View File

@ -58,8 +58,8 @@ func main() {
tlogger.Init(cfg.Logger)
go stats.Init("n9e.index")
cache.InitDB(cfg.Cache)
identity.Init(cfg.Identity)
cache.InitDB(cfg.Cache)
go report.Init(cfg.Report, "monapi")
go rpc.Start()