From 9f67cdf7730d68b054a7897c4e937d2fcfb0e1ad Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" Date: Tue, 3 Mar 2020 05:47:52 -0600 Subject: [PATCH 1/3] Change Version so it can be set at compile time. @extensions --- cmd/gotop/main.go | 7 +++---- devices/cpu.go | 2 ++ docs/releasing.md | 12 ++++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go index 4ce78ba..f6b6dfc 100644 --- a/cmd/gotop/main.go +++ b/cmd/gotop/main.go @@ -28,8 +28,6 @@ import ( const ( appName = "gotop" - // TODO: Set this at compile time; having to check this in sucks. - version = "3.4.5" graphHorizontalScaleDelta = 3 defaultUI = "cpu\ndisk/1 2:mem/2\ntemp\nnet procs" @@ -39,6 +37,8 @@ const ( ) var ( + // TODO: Set this at compile time; having to check this in sucks. + Version = "3.4.5" conf gotop.Config help *w.HelpMenu bar *w.StatusBar @@ -50,7 +50,6 @@ var ( // TODO: state:merge #135 linux console font (cmatsuoka/console-font) // TODO: state:deferred 157 FreeBSD fixes & Nvidia GPU support (kraust/master). Significant CPU use impact for NVidia changes. // TODO: Virtual devices from Prometeus metrics @feature -// TODO: state:merge #167 configuration file (jrswab/configFile111) // TODO: Abstract out the UI toolkit. mum4k/termdash, VladimirMarkelov/clui, gcla/gowid, rivo/tview, marcusolsson/tui-go might work better for some OS/Archs. Performance/memory use comparison would be interesting. func parseArgs(conf *gotop.Config) error { usage := ` @@ -97,7 +96,7 @@ Colorschemes: return err } - args, err := docopt.ParseArgs(usage, os.Args[1:], version) + args, err := docopt.ParseArgs(usage, os.Args[1:], Version) if err != nil { return err } diff --git a/devices/cpu.go b/devices/cpu.go index 436ccb1..1d8d23d 100644 --- a/devices/cpu.go +++ b/devices/cpu.go @@ -1,5 +1,7 @@ package devices +// TODO: https://github.com/elastic/go-sysinfo + import ( "log" "time" diff --git a/docs/releasing.md b/docs/releasing.md index 643bc9f..4c6583c 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -14,3 +14,15 @@ credentials to aurpublish to the AUR repository, so the final publish step is still currently manual. Oh, what a tangled web. + + +Nix adds new and interesting complexities to the release. + +1. cd to the nixpkgs directory +2. docker run -it --rm --mount type=bind,source="\$(pwd)",target=/mnt nixos/nix sh +3. cd /mnt +4. nix-prefetch-url --unpack https://github.com/xxxserxxx/gotop/archive/v3.3.2.tar.gz +5. Copy the sha256 +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 From 120f9f291ed81a925a603581105c4bbe3d84bf8a Mon Sep 17 00:00:00 2001 From: xxxserxxx <60757196+xxxserxxx@users.noreply.github.com> Date: Tue, 3 Mar 2020 06:15:40 -0600 Subject: [PATCH 2/3] More instructions --- .github/ISSUE_TEMPLATE/bug_report.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 6c1ca65..a65c874 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -6,12 +6,15 @@ about: Template to report bugs. -Required information: - -- gotop version (`gotop -V`): -- The output of `uname -a`: -- Terminal emulator (e.g. iTerm or gnome terminal): -- Any relevenat hardware info: -- tmux version if using tmux: +##### gotop version: +`gotop -V`, or if built from source, `git rev-parse HEAD` +##### OS/Arch: +Linux: `uname -or`, OSX: `sw_vers`; Windows: `systeminfo | findstr /B /C:"OS Name" /C:"OS Version"` +##### Terminal emulator: +e.g. iTerm, kitty, xterm, PowerShell +##### Any relevenat hardware info: +If the issue is clearly related to a specific piece of hardware, e.g., the network +##### tmux version: +`tmux -V`, if using tmux Also please copy or attach `~/.local/state/gotop/errors.log` if it exists and contains logs: From 4db86f0c2d9a7c2b6ce261961d2fd6aa8ec09675 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" Date: Tue, 3 Mar 2020 06:36:42 -0600 Subject: [PATCH 3/3] Prevent crashes on Windows from wonky CPU values #70 --- devices/cpu_cpu.go | 6 +++++- docs/releasing.md | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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 +```