diff --git a/app/vmalert/replay.go b/app/vmalert/replay.go index c02112241..16f182902 100644 --- a/app/vmalert/replay.go +++ b/app/vmalert/replay.go @@ -7,13 +7,12 @@ import ( "strings" "time" - "github.com/cheggaaa/pb/v3" - "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/config" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/datasource" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/remotewrite" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" "github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal" + "github.com/dmitryk-dk/pb/v3" ) var ( diff --git a/app/vmctl/barpool/pool.go b/app/vmctl/barpool/pool.go index 4f095d8ac..c81c81cee 100644 --- a/app/vmctl/barpool/pool.go +++ b/app/vmctl/barpool/pool.go @@ -3,7 +3,7 @@ // altogether. package barpool -import "github.com/cheggaaa/pb/v3" +import "github.com/dmitryk-dk/pb/v3" var pool = pb.NewPool() diff --git a/app/vmctl/opentsdb.go b/app/vmctl/opentsdb.go index e31de67f0..b54f7fd8a 100644 --- a/app/vmctl/opentsdb.go +++ b/app/vmctl/opentsdb.go @@ -8,7 +8,7 @@ import ( "github.com/VictoriaMetrics/VictoriaMetrics/app/vmctl/opentsdb" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmctl/vm" - "github.com/cheggaaa/pb/v3" + "github.com/dmitryk-dk/pb/v3" ) type otsdbProcessor struct { diff --git a/app/vmctl/vm/vm.go b/app/vmctl/vm/vm.go index 8809db7a2..481258532 100644 --- a/app/vmctl/vm/vm.go +++ b/app/vmctl/vm/vm.go @@ -13,11 +13,10 @@ import ( "sync" "time" - "github.com/cheggaaa/pb/v3" - "github.com/VictoriaMetrics/VictoriaMetrics/app/vmctl/barpool" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmctl/limiter" "github.com/VictoriaMetrics/VictoriaMetrics/lib/decimal" + "github.com/dmitryk-dk/pb/v3" ) // Config contains list of params to configure diff --git a/go.mod b/go.mod index ffa2f44cc..38cafc815 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/VictoriaMetrics/metricsql v0.43.0 github.com/aws/aws-sdk-go v1.44.9 github.com/cespare/xxhash/v2 v2.1.2 - github.com/cheggaaa/pb/v3 v3.0.9-0.20211222075416-90c02fa07ea4 + github.com/dmitryk-dk/pb/v3 v3.0.9 github.com/golang/snappy v0.0.4 github.com/influxdata/influxdb v1.9.6 github.com/klauspost/compress v1.15.3 diff --git a/go.sum b/go.sum index 698abb12b..416971a24 100644 --- a/go.sum +++ b/go.sum @@ -198,8 +198,6 @@ github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tj github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cheggaaa/pb/v3 v3.0.9-0.20211222075416-90c02fa07ea4 h1:sbHAiGddrdLsd3i9/RYsm0OKOEh+UDFOONxai8YMMcw= -github.com/cheggaaa/pb/v3 v3.0.9-0.20211222075416-90c02fa07ea4/go.mod h1:UICbiLec/XO6Hw6k+BHEtHeQFzzBH4i2/qk/ow1EJTA= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -244,6 +242,8 @@ github.com/dgryski/go-sip13 v0.0.0-20190329191031-25c5027a8c7b/go.mod h1:vAd38F8 github.com/dgryski/go-sip13 v0.0.0-20200911182023-62edffca9245/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/digitalocean/godo v1.52.0/go.mod h1:p7dOjjtSBqCTUksqtA5Fd3uaKs9kyTq2xcz76ulEJRU= github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= +github.com/dmitryk-dk/pb/v3 v3.0.9 h1:wpWkldo8V6NeONVgmuCvsDIDjSRkJfbTbdoVigKYJ2I= +github.com/dmitryk-dk/pb/v3 v3.0.9/go.mod h1:o9xpZcwYZHNdNaAlJVvWTA+YH+IlPciBs1myroBOxyM= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v17.12.0-ce-rc1.0.20200706150819-a40b877fbb9e+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= diff --git a/vendor/github.com/cheggaaa/pb/v3/preset.go b/vendor/github.com/cheggaaa/pb/v3/preset.go deleted file mode 100644 index f5e2fff57..000000000 --- a/vendor/github.com/cheggaaa/pb/v3/preset.go +++ /dev/null @@ -1,15 +0,0 @@ -package pb - -var ( - // Full - preset with all default available elements - // Example: 'Prefix 20/100 [-->______] 20% 1 p/s ETA 1m Suffix' - Full ProgressBarTemplate = `{{string . "prefix"}}{{counters . }} {{bar . }} {{percent . }} {{speed . }} {{rtime . "ETA %s"}}{{string . "suffix"}}` - - // Default - preset like Full but without elapsed time - // Example: 'Prefix 20/100 [-->______] 20% 1 p/s ETA 1m Suffix' - Default ProgressBarTemplate = `{{string . "prefix"}}{{counters . }} {{bar . }} {{percent . }} {{speed . }}{{string . "suffix"}}` - - // Simple - preset without speed and any timers. Only counters, bar and percents - // Example: 'Prefix 20/100 [-->______] 20% Suffix' - Simple ProgressBarTemplate = `{{string . "prefix"}}{{counters . }} {{bar . }} {{percent . }}{{string . "suffix"}}` -) diff --git a/vendor/github.com/cheggaaa/pb/v3/termutil/term_nix.go b/vendor/github.com/cheggaaa/pb/v3/termutil/term_nix.go deleted file mode 100644 index 14277e71f..000000000 --- a/vendor/github.com/cheggaaa/pb/v3/termutil/term_nix.go +++ /dev/null @@ -1,8 +0,0 @@ -// +build linux darwin freebsd netbsd openbsd dragonfly -// +build !appengine - -package termutil - -import "syscall" - -const sysIoctl = syscall.SYS_IOCTL diff --git a/vendor/github.com/cheggaaa/pb/v3/LICENSE b/vendor/github.com/dmitryk-dk/pb/v3/LICENSE similarity index 100% rename from vendor/github.com/cheggaaa/pb/v3/LICENSE rename to vendor/github.com/dmitryk-dk/pb/v3/LICENSE diff --git a/vendor/github.com/cheggaaa/pb/v3/element.go b/vendor/github.com/dmitryk-dk/pb/v3/element.go similarity index 100% rename from vendor/github.com/cheggaaa/pb/v3/element.go rename to vendor/github.com/dmitryk-dk/pb/v3/element.go diff --git a/vendor/github.com/cheggaaa/pb/v3/io.go b/vendor/github.com/dmitryk-dk/pb/v3/io.go similarity index 100% rename from vendor/github.com/cheggaaa/pb/v3/io.go rename to vendor/github.com/dmitryk-dk/pb/v3/io.go diff --git a/vendor/github.com/cheggaaa/pb/v3/pb.go b/vendor/github.com/dmitryk-dk/pb/v3/pb.go similarity index 99% rename from vendor/github.com/cheggaaa/pb/v3/pb.go rename to vendor/github.com/dmitryk-dk/pb/v3/pb.go index 76440e172..3ace32ef2 100644 --- a/vendor/github.com/cheggaaa/pb/v3/pb.go +++ b/vendor/github.com/dmitryk-dk/pb/v3/pb.go @@ -17,7 +17,7 @@ import ( "github.com/mattn/go-colorable" "github.com/mattn/go-isatty" - "github.com/cheggaaa/pb/v3/termutil" + "github.com/dmitryk-dk/pb/v3/termutil" ) // Version of ProgressBar library diff --git a/vendor/github.com/cheggaaa/pb/v3/pool.go b/vendor/github.com/dmitryk-dk/pb/v3/pool.go similarity index 92% rename from vendor/github.com/cheggaaa/pb/v3/pool.go rename to vendor/github.com/dmitryk-dk/pb/v3/pool.go index 69cc825b6..6f6609989 100644 --- a/vendor/github.com/cheggaaa/pb/v3/pool.go +++ b/vendor/github.com/dmitryk-dk/pb/v3/pool.go @@ -1,4 +1,4 @@ -// +build linux darwin freebsd netbsd openbsd solaris dragonfly windows plan9 aix +//go:build linux || darwin || freebsd || netbsd || openbsd || solaris || dragonfly || windows || plan9 || aix package pb @@ -7,7 +7,7 @@ import ( "sync" "time" - "github.com/cheggaaa/pb/v3/termutil" + "github.com/dmitryk-dk/pb/v3/termutil" ) // Create and start new pool with given bars diff --git a/vendor/github.com/cheggaaa/pb/v3/pool_win.go b/vendor/github.com/dmitryk-dk/pb/v3/pool_win.go similarity index 86% rename from vendor/github.com/cheggaaa/pb/v3/pool_win.go rename to vendor/github.com/dmitryk-dk/pb/v3/pool_win.go index 35a61474a..dcdfa9fa4 100644 --- a/vendor/github.com/cheggaaa/pb/v3/pool_win.go +++ b/vendor/github.com/dmitryk-dk/pb/v3/pool_win.go @@ -1,4 +1,4 @@ -// +build windows +//go:build windows package pb @@ -6,7 +6,7 @@ import ( "fmt" "log" - "github.com/cheggaaa/pb/v3/termutil" + "github.com/dmitryk-dk/pb/v3/termutil" ) func (p *Pool) print(first bool) bool { @@ -24,7 +24,7 @@ func (p *Pool) print(first bool) bool { } coords.X = 0 - err = termutil.SetCursorPos(coords) + err = termutil.SetCursorPos(coords) if err != nil { log.Panic(err) } diff --git a/vendor/github.com/cheggaaa/pb/v3/pool_x.go b/vendor/github.com/dmitryk-dk/pb/v3/pool_x.go similarity index 84% rename from vendor/github.com/cheggaaa/pb/v3/pool_x.go rename to vendor/github.com/dmitryk-dk/pb/v3/pool_x.go index 435030155..552289be7 100644 --- a/vendor/github.com/cheggaaa/pb/v3/pool_x.go +++ b/vendor/github.com/dmitryk-dk/pb/v3/pool_x.go @@ -1,4 +1,4 @@ -// +build linux darwin freebsd netbsd openbsd solaris dragonfly plan9 aix +//go:build linux || darwin || freebsd || netbsd || openbsd || solaris || dragonfly || plan9 || aix package pb @@ -6,7 +6,7 @@ import ( "fmt" "os" - "github.com/cheggaaa/pb/v3/termutil" + "github.com/dmitryk-dk/pb/v3/termutil" ) func (p *Pool) print(first bool) bool { diff --git a/vendor/github.com/dmitryk-dk/pb/v3/preset.go b/vendor/github.com/dmitryk-dk/pb/v3/preset.go new file mode 100644 index 000000000..f3ca19398 --- /dev/null +++ b/vendor/github.com/dmitryk-dk/pb/v3/preset.go @@ -0,0 +1,15 @@ +package pb + +var ( + // Full - preset with all default available elements + // Example: 'Prefix 20/100 [-->______] 20% 1 p/s ETA 1m Suffix' + Full ProgressBarTemplate = `{{with string . "prefix"}}{{.}} {{end}}{{counters . }} {{bar . }} {{percent . }} {{speed . }} {{rtime . "ETA %s"}}{{with string . "suffix"}} {{.}}{{end}}` + + // Default - preset like Full but without elapsed time + // Example: 'Prefix 20/100 [-->______] 20% 1 p/s Suffix' + Default ProgressBarTemplate = `{{with string . "prefix"}}{{.}} {{end}}{{counters . }} {{bar . }} {{percent . }} {{speed . }}{{with string . "suffix"}} {{.}}{{end}}` + + // Simple - preset without speed and any timers. Only counters, bar and percents + // Example: 'Prefix 20/100 [-->______] 20% Suffix' + Simple ProgressBarTemplate = `{{with string . "prefix"}}{{.}} {{end}}{{counters . }} {{bar . }} {{percent . }}{{with string . "suffix"}} {{.}}{{end}}` +) diff --git a/vendor/github.com/cheggaaa/pb/v3/speed.go b/vendor/github.com/dmitryk-dk/pb/v3/speed.go similarity index 100% rename from vendor/github.com/cheggaaa/pb/v3/speed.go rename to vendor/github.com/dmitryk-dk/pb/v3/speed.go diff --git a/vendor/github.com/cheggaaa/pb/v3/template.go b/vendor/github.com/dmitryk-dk/pb/v3/template.go similarity index 100% rename from vendor/github.com/cheggaaa/pb/v3/template.go rename to vendor/github.com/dmitryk-dk/pb/v3/template.go diff --git a/vendor/github.com/cheggaaa/pb/v3/termutil/term.go b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term.go similarity index 100% rename from vendor/github.com/cheggaaa/pb/v3/termutil/term.go rename to vendor/github.com/dmitryk-dk/pb/v3/termutil/term.go diff --git a/vendor/github.com/cheggaaa/pb/v3/termutil/term_appengine.go b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_appengine.go similarity index 92% rename from vendor/github.com/cheggaaa/pb/v3/termutil/term_appengine.go rename to vendor/github.com/dmitryk-dk/pb/v3/termutil/term_appengine.go index 4b7b20e6b..765ff2bdf 100644 --- a/vendor/github.com/cheggaaa/pb/v3/termutil/term_appengine.go +++ b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_appengine.go @@ -1,4 +1,4 @@ -// +build appengine +//go:build appengine package termutil diff --git a/vendor/github.com/cheggaaa/pb/v3/termutil/term_bsd.go b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_bsd.go similarity index 60% rename from vendor/github.com/cheggaaa/pb/v3/termutil/term_bsd.go rename to vendor/github.com/dmitryk-dk/pb/v3/termutil/term_bsd.go index 272659a12..d29404a39 100644 --- a/vendor/github.com/cheggaaa/pb/v3/termutil/term_bsd.go +++ b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_bsd.go @@ -1,5 +1,4 @@ -// +build darwin freebsd netbsd openbsd dragonfly -// +build !appengine +//go:build (darwin || freebsd || netbsd || openbsd || dragonfly) && !appengine package termutil diff --git a/vendor/github.com/cheggaaa/pb/v3/termutil/term_linux.go b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_linux.go similarity index 76% rename from vendor/github.com/cheggaaa/pb/v3/termutil/term_linux.go rename to vendor/github.com/dmitryk-dk/pb/v3/termutil/term_linux.go index 2f59e53e1..bec62af6c 100644 --- a/vendor/github.com/cheggaaa/pb/v3/termutil/term_linux.go +++ b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_linux.go @@ -1,5 +1,4 @@ -// +build linux -// +build !appengine +//go:build linux && !appengine package termutil diff --git a/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_nix.go b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_nix.go new file mode 100644 index 000000000..4513e37d4 --- /dev/null +++ b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_nix.go @@ -0,0 +1,7 @@ +//go:build (linux || darwin || freebsd || netbsd || openbsd || dragonfly) && !appengine + +package termutil + +import "syscall" + +const sysIoctl = syscall.SYS_IOCTL diff --git a/vendor/github.com/cheggaaa/pb/v3/termutil/term_plan9.go b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_plan9.go similarity index 100% rename from vendor/github.com/cheggaaa/pb/v3/termutil/term_plan9.go rename to vendor/github.com/dmitryk-dk/pb/v3/termutil/term_plan9.go diff --git a/vendor/github.com/cheggaaa/pb/v3/termutil/term_solaris.go b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_solaris.go similarity index 78% rename from vendor/github.com/cheggaaa/pb/v3/termutil/term_solaris.go rename to vendor/github.com/dmitryk-dk/pb/v3/termutil/term_solaris.go index fc96c2b7f..02cfabf44 100644 --- a/vendor/github.com/cheggaaa/pb/v3/termutil/term_solaris.go +++ b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_solaris.go @@ -1,5 +1,4 @@ -// +build solaris -// +build !appengine +//go:build solaris && !appengine package termutil diff --git a/vendor/github.com/cheggaaa/pb/v3/termutil/term_win.go b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_win.go similarity index 99% rename from vendor/github.com/cheggaaa/pb/v3/termutil/term_win.go rename to vendor/github.com/dmitryk-dk/pb/v3/termutil/term_win.go index 3150dfd31..1ccf131e9 100644 --- a/vendor/github.com/cheggaaa/pb/v3/termutil/term_win.go +++ b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_win.go @@ -1,4 +1,4 @@ -// +build windows +//go:build windows package termutil diff --git a/vendor/github.com/cheggaaa/pb/v3/termutil/term_x.go b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_x.go similarity index 55% rename from vendor/github.com/cheggaaa/pb/v3/termutil/term_x.go rename to vendor/github.com/dmitryk-dk/pb/v3/termutil/term_x.go index 1674d3e5e..0b48aae93 100644 --- a/vendor/github.com/cheggaaa/pb/v3/termutil/term_x.go +++ b/vendor/github.com/dmitryk-dk/pb/v3/termutil/term_x.go @@ -1,5 +1,4 @@ -// +build linux darwin freebsd netbsd openbsd solaris dragonfly -// +build !appengine +//go:build (linux || darwin || freebsd || netbsd || openbsd || solaris || dragonfly) && !appengine package termutil @@ -16,6 +15,7 @@ var ( unlockSignals = []os.Signal{ os.Interrupt, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGKILL, } + oldState syscall.Termios ) type window struct { @@ -53,30 +53,27 @@ func TerminalSize() (rows, cols int, err error) { return int(w.Row), int(w.Col), nil } -var oldState syscall.Termios - -func lockEcho() (err error) { +func lockEcho() error { fd := tty.Fd() - if _, _, e := syscall.Syscall6(sysIoctl, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&oldState)), 0, 0, 0); e != 0 { - err = fmt.Errorf("Can't get terminal settings: %v", e) - return + + if _, _, err := syscall.Syscall(sysIoctl, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&oldState))); err != 0 { + return fmt.Errorf("error when puts the terminal connected to the given file descriptor: %v", err) } newState := oldState newState.Lflag &^= syscall.ECHO newState.Lflag |= syscall.ICANON | syscall.ISIG newState.Iflag |= syscall.ICRNL - if _, _, e := syscall.Syscall6(sysIoctl, fd, ioctlWriteTermios, uintptr(unsafe.Pointer(&newState)), 0, 0, 0); e != 0 { - err = fmt.Errorf("Can't set terminal settings: %v", e) - return + if _, _, e := syscall.Syscall(sysIoctl, fd, ioctlWriteTermios, uintptr(unsafe.Pointer(&newState))); e != 0 { + return fmt.Errorf("error update terminal settings: %v", e) } - return + return nil } -func unlockEcho() (err error) { +func unlockEcho() error { fd := tty.Fd() - if _, _, e := syscall.Syscall6(sysIoctl, fd, ioctlWriteTermios, uintptr(unsafe.Pointer(&oldState)), 0, 0, 0); e != 0 { - err = fmt.Errorf("Can't set terminal settings") + if _, _, err := syscall.Syscall(sysIoctl, fd, ioctlWriteTermios, uintptr(unsafe.Pointer(&oldState))); err != 0 { + return fmt.Errorf("error restores the terminal connected to the given file descriptor: %w", err) } - return + return nil } diff --git a/vendor/github.com/cheggaaa/pb/v3/util.go b/vendor/github.com/dmitryk-dk/pb/v3/util.go similarity index 100% rename from vendor/github.com/cheggaaa/pb/v3/util.go rename to vendor/github.com/dmitryk-dk/pb/v3/util.go diff --git a/vendor/modules.txt b/vendor/modules.txt index 55a60e3d9..2f6093d39 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -93,13 +93,13 @@ github.com/beorn7/perks/quantile # github.com/cespare/xxhash/v2 v2.1.2 ## explicit; go 1.11 github.com/cespare/xxhash/v2 -# github.com/cheggaaa/pb/v3 v3.0.9-0.20211222075416-90c02fa07ea4 -## explicit; go 1.12 -github.com/cheggaaa/pb/v3 -github.com/cheggaaa/pb/v3/termutil # github.com/cpuguy83/go-md2man/v2 v2.0.2 ## explicit; go 1.11 github.com/cpuguy83/go-md2man/v2/md2man +# github.com/dmitryk-dk/pb/v3 v3.0.9 +## explicit; go 1.18 +github.com/dmitryk-dk/pb/v3 +github.com/dmitryk-dk/pb/v3/termutil # github.com/fatih/color v1.13.0 ## explicit; go 1.13 github.com/fatih/color