diff options
author | Mission Liao <mission.liao@dexon.org> | 2019-05-07 11:15:18 +0800 |
---|---|---|
committer | Mission Liao <mission.liao@dexon.org> | 2019-05-07 15:09:40 +0800 |
commit | e81964e6693b3d63a925ea1bbe52c889fbaa48aa (patch) | |
tree | 2b3c57147395bf92b6e0bad635c7427c05e40427 | |
parent | 15946542d1d573e5ffb8635c3b9ea04830fc1442 (diff) | |
download | dexon-e81964e6693b3d63a925ea1bbe52c889fbaa48aa.tar.gz dexon-e81964e6693b3d63a925ea1bbe52c889fbaa48aa.tar.zst dexon-e81964e6693b3d63a925ea1bbe52c889fbaa48aa.zip |
Fix lint error: should replace loop
-rw-r--r-- | dex/consensus/common/logger.go | 6 | ||||
-rw-r--r-- | dex/consensus/core/test/state.go | 4 | ||||
-rw-r--r-- | dex/consensus/core/utils.go | 4 |
3 files changed, 3 insertions, 11 deletions
diff --git a/dex/consensus/common/logger.go b/dex/consensus/common/logger.go index 3328e939a..31fd3fdb6 100644 --- a/dex/consensus/common/logger.go +++ b/dex/consensus/common/logger.go @@ -64,11 +64,7 @@ type SimpleLogger struct{} // composeVargs makes (msg, ctx...) could be pass to log.Println func composeVargs(msg string, ctxs []interface{}) []interface{} { - args := []interface{}{msg} - for _, c := range ctxs { - args = append(args, c) - } - return args + return append([]interface{}{msg}, ctxs...) } // Trace implements Logger interface. diff --git a/dex/consensus/core/test/state.go b/dex/consensus/core/test/state.go index ddcd2d83a..0564ddd04 100644 --- a/dex/consensus/core/test/state.go +++ b/dex/consensus/core/test/state.go @@ -531,9 +531,7 @@ func (s *State) Clone() (copied *State) { copied.dkgSuccesses[round][nID] = CloneDKGSuccess(success) } } - for _, crs := range s.crs { - copied.crs = append(copied.crs, crs) - } + copied.crs = append(copied.crs, s.crs...) copied.dkgResetCount = make(map[uint64]uint64, len(s.dkgResetCount)) for round, count := range s.dkgResetCount { copied.dkgResetCount[round] = count diff --git a/dex/consensus/core/utils.go b/dex/consensus/core/utils.go index f04e9e244..428df2fe7 100644 --- a/dex/consensus/core/utils.go +++ b/dex/consensus/core/utils.go @@ -104,9 +104,7 @@ func getMedianTime(timestamps []time.Time) (t time.Time, err error) { return } tscopy := make([]time.Time, 0, len(timestamps)) - for _, ts := range timestamps { - tscopy = append(tscopy, ts) - } + tscopy = append(tscopy, timestamps...) sort.Sort(common.ByTime(tscopy)) if len(tscopy)%2 == 0 { t1 := tscopy[len(tscopy)/2-1] |