Prevent crashes on Windows from wonky CPU values #70

This commit is contained in:
Sean E. Russell 2020-03-03 06:36:42 -06:00
parent 20a90672d6
commit ffbd8828dc
2 changed files with 12 additions and 1 deletions

View File

@ -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
}

View File

@ -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
```