diff --git a/src/modules/collector/log/reader/reader.go b/src/modules/collector/log/reader/reader.go index f5b0b960..f5460592 100644 --- a/src/modules/collector/log/reader/reader.go +++ b/src/modules/collector/log/reader/reader.go @@ -57,7 +57,7 @@ func (r *Reader) StartRead() { var readCnt, readSwp int64 var dropCnt, dropSwp int64 - analysClose := make(chan int, 0) + analysClose := make(chan int) go func() { for { // 十秒钟统计一次 diff --git a/src/modules/collector/log/strategy/strategy.go b/src/modules/collector/log/strategy/strategy.go index 09f08be7..2cf81ee7 100644 --- a/src/modules/collector/log/strategy/strategy.go +++ b/src/modules/collector/log/strategy/strategy.go @@ -14,7 +14,7 @@ var ( ) func init() { - globalStrategy = make(map[int64]*stra.Strategy, 0) + globalStrategy = make(map[int64]*stra.Strategy) } func Update() error { @@ -22,7 +22,7 @@ func Update() error { err := UpdateGlobalStrategy(strategies) if err != nil { - logger.Errorf("Update Strategy cache error ! [msg:%v]", err) + logger.Errorf("Update Strategy cache error:%v\n", err) return err } logger.Infof("Update Strategy end") @@ -30,7 +30,7 @@ func Update() error { } func UpdateGlobalStrategy(sts []*stra.Strategy) error { - tmpStrategyMap := make(map[int64]*stra.Strategy, 0) + tmpStrategyMap := make(map[int64]*stra.Strategy) for _, st := range sts { if st.Degree == 0 { st.Degree = 6 diff --git a/src/modules/collector/log/worker/cached.go b/src/modules/collector/log/worker/cached.go index 5f7fe579..2cd8d150 100644 --- a/src/modules/collector/log/worker/cached.go +++ b/src/modules/collector/log/worker/cached.go @@ -25,7 +25,7 @@ type pushPointsCache struct { Counters map[string]*counterCache `json:"counters"` } -var globalPushPoints = pushPointsCache{Counters: make(map[string]*counterCache, 0)} +var globalPushPoints = pushPointsCache{Counters: make(map[string]*counterCache)} func init() { go CleanLoop() diff --git a/src/modules/collector/log/worker/counter.go b/src/modules/collector/log/worker/counter.go index 3e14c53f..477b0c39 100644 --- a/src/modules/collector/log/worker/counter.go +++ b/src/modules/collector/log/worker/counter.go @@ -253,7 +253,7 @@ func (sc *StrategyCounter) AddTms(tms int64) error { _, ok := sc.TmsPoints[tms] if !ok { tmp := new(PointsCounter) - tmp.TagstringMap = make(map[string]*PointCounter, 0) + tmp.TagstringMap = make(map[string]*PointCounter) sc.TmsPoints[tms] = tmp } sc.Unlock() @@ -300,7 +300,7 @@ func (gc *GlobalCounter) AddStrategyCount(st *stra.Strategy) { if _, ok := gc.StrategyCounts[st.ID]; !ok { tmp := new(StrategyCounter) tmp.Strategy = st - tmp.TmsPoints = make(map[int64]*PointsCounter, 0) + tmp.TmsPoints = make(map[int64]*PointsCounter) gc.StrategyCounts[st.ID] = tmp } gc.Unlock() @@ -348,7 +348,7 @@ func (gc *GlobalCounter) cleanStrategyData(id int64) { if !ok || sCount == nil { return } - sCount.TmsPoints = make(map[int64]*PointsCounter, 0) + sCount.TmsPoints = make(map[int64]*PointsCounter) return } diff --git a/src/modules/collector/log/worker/push.go b/src/modules/collector/log/worker/push.go index a0ddb288..184d32f8 100644 --- a/src/modules/collector/log/worker/push.go +++ b/src/modules/collector/log/worker/push.go @@ -165,7 +165,7 @@ func ToPushQueue(strategy *stra.Strategy, tms int64, pointMap map[string]*PointC var tags map[string]string if tagstring == "null" { - tags = make(map[string]string, 0) + tags = make(map[string]string) } else { tags = dataobj.DictedTagstring(tagstring) } diff --git a/src/modules/collector/log/worker/worker.go b/src/modules/collector/log/worker/worker.go index 2913d23d..08e238df 100644 --- a/src/modules/collector/log/worker/worker.go +++ b/src/modules/collector/log/worker/worker.go @@ -136,7 +136,7 @@ func (w *Worker) Work() { logger.Infof("worker starting...[%s]", w.Mark) var anaCnt, anaSwp int64 - analysClose := make(chan int, 0) + analysClose := make(chan int) go func() { for { diff --git a/src/modules/collector/stra/log.go b/src/modules/collector/stra/log.go index 69cac11a..80ec4e98 100644 --- a/src/modules/collector/stra/log.go +++ b/src/modules/collector/stra/log.go @@ -165,7 +165,7 @@ func parsePattern(strategies []*Strategy) { func updateRegs(strategies []*Strategy) { for _, st := range strategies { - st.TagRegs = make(map[string]*regexp.Regexp, 0) + st.TagRegs = make(map[string]*regexp.Regexp) st.ParseSucc = false //更新时间正则