mirror of
https://github.com/singchia/frontier.git
synced 2025-09-26 20:31:25 +08:00
test: add print map misc func
This commit is contained in:
22
test/misc/misc.go
Normal file
22
test/misc/misc.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package misc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func PrintMap(m map[string]uint64) {
|
||||
var maxLenKey int
|
||||
for k := range m {
|
||||
if len(k) > maxLenKey {
|
||||
maxLenKey = len(k)
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range m {
|
||||
fmt.Println(k + ": " + strings.Repeat(" ", maxLenKey-len(k)) + strconv.FormatUint(v, 10))
|
||||
}
|
||||
fmt.Println(" -----", time.Now().Format("2006-01-02 15:04:05"))
|
||||
}
|
Reference in New Issue
Block a user