summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2020-03-03 06:36:42 -0600
committerSean E. Russell <ser@ser1.net>2020-03-03 06:36:42 -0600
commit4db86f0c2d9a7c2b6ce261961d2fd6aa8ec09675 (patch)
treeb5a3ca4dfe554e899375dc96e2fd620e1d6060bc
parent9f67cdf7730d68b054a7897c4e937d2fcfb0e1ad (diff)
Prevent crashes on Windows from wonky CPU values #70
-rw-r--r--devices/cpu_cpu.go6
-rw-r--r--docs/releasing.md7
2 files changed, 12 insertions, 1 deletions
diff --git a/devices/cpu_cpu.go b/devices/cpu_cpu.go
index a1d20cd..42eff2e 100644
--- a/devices/cpu_cpu.go
+++ b/devices/cpu_cpu.go
@@ -23,7 +23,11 @@ func init() {
}
for i := 0; i < len(vals); i++ {
key := fmt.Sprintf(formatString, i)
- cpus[key] = int(vals[i])
+ v := vals[i]
+ if v > 100 {
+ v = 100
+ }
+ cpus[key] = int(v)
}
return nil
}
diff --git a/docs/releasing.md b/docs/releasing.md
index 4c6583c..d77b6dd 100644
--- a/docs/releasing.md
+++ b/docs/releasing.md
@@ -26,3 +26,10 @@ Nix adds new and interesting complexities to the release.
6. Update the version and hash in nixpkgs/pkgs/tools/system/gotop/default.nix
8. In docker, install & run vgo2nix to update deps.nix
7. nix-build -A gotop
+
+
+For plugin development:
+```
+V=$(git show -s --format=%cI HEAD | cut -b -19 | tr -cd '[:digit:]')-$(git rev-parse HEAD | cut -b -12)
+go build -ldflags "-X main.Version=$V" -o gotop ./cmd/gotop
+```