feat: show version in stats
This commit is contained in:
7
stats.go
7
stats.go
@@ -4,6 +4,7 @@ import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -25,10 +26,16 @@ func stats(dev *device.Device) func() (any, error) {
|
||||
SentBytes int64
|
||||
|
||||
NumGoroutine int
|
||||
Version string
|
||||
}{
|
||||
NumGoroutine: runtime.NumGoroutine(),
|
||||
}
|
||||
|
||||
info, ok := debug.ReadBuildInfo()
|
||||
if ok {
|
||||
stats.Version = info.Main.Version
|
||||
}
|
||||
|
||||
scanner := bufio.NewScanner(&buf)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
|
||||
Reference in New Issue
Block a user