From c1a4f15017242ed5bb77cea48803b8a396d6b152 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 30 Mar 2022 00:18:23 +0300 Subject: [PATCH 1/3] Migrate to go modules + Improve GitHub actions workflows --- .github/dependabot.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 6 +++--- .github/workflows/codeql.yml | 5 +---- Makefile | 24 ++++++++++++++++-------- README.md | 2 +- common/redis-latency-monitor.spec | 12 +++++++++--- go.mod | 5 +++++ go.sum | 27 +++++++++++++++++++++++++++ redis-latency-monitor.go | 26 +++++++++++++------------- stats/stats.go | 2 +- 10 files changed, 106 insertions(+), 33 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 go.mod create mode 100644 go.sum diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..fc51337 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,30 @@ +version: 2 + +updates: + - package-ecosystem: "gomod" + directory: "/" + target-branch: "develop" + schedule: + interval: "daily" + timezone: "Europe/London" + time: "03:00" + labels: + - "PR • MAINTENANCE" + assignees: + - "andyone" + reviewers: + - "andyone" + + - package-ecosystem: "github-actions" + directory: "/" + target-branch: "develop" + schedule: + interval: "daily" + timezone: "Europe/London" + time: "04:00" + labels: + - "PR • MAINTENANCE" + assignees: + - "andyone" + reviewers: + - "andyone" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93cfe5f..beb6781 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: - go: [ '1.16.x', '1.17.x' ] + go: [ '1.17.x', '1.18.x' ] steps: - name: Set up Go @@ -35,7 +35,7 @@ jobs: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: ${{env.SRC_DIR}} @@ -55,7 +55,7 @@ jobs: steps: - name: Code checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Login to DockerHub uses: docker/login-action@v1 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index c7466d5..3444662 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -6,7 +6,7 @@ on: pull_request: branches: [master] schedule: - - cron: '0 20 * * 1,3,5' + - cron: '0 17 * * 1,3,5' jobs: analyse: @@ -19,9 +19,6 @@ jobs: with: fetch-depth: 2 - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - - name: Initialize CodeQL uses: github/codeql-action/init@v1 with: diff --git a/Makefile b/Makefile index 38f81e6..28aaeeb 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,16 @@ ################################################################################ -# This Makefile generated by GoMakeGen 1.3.0 using next command: -# gomakegen . +# This Makefile generated by GoMakeGen 1.5.1 using next command: +# gomakegen --mod . # # More info: https://kaos.sh/gomakegen ################################################################################ +export GO111MODULE=on + .DEFAULT_GOAL := help -.PHONY = fmt vet all clean git-config deps help +.PHONY = fmt vet all clean deps mod-init mod-update mod-vendor help ################################################################################ @@ -23,11 +25,17 @@ install: ## Install all binaries uninstall: ## Uninstall all binaries rm -f /usr/bin/redis-latency-monitor -git-config: ## Configure git redirects for stable import path services - git config --global http.https://pkg.re.followRedirects true +deps: mod-update ## Download dependencies + +mod-init: ## Initialize new module + go mod init + go mod tidy + +mod-update: ## Download modules to local cache + go mod download -deps: git-config ## Download dependencies - go get -d -v pkg.re/essentialkaos/ek.v11 +mod-vendor: ## Make vendored copy of dependencies + go mod vendor fmt: ## Format source code with gofmt find . -name "*.go" -exec gofmt -s -w {} \; @@ -43,6 +51,6 @@ help: ## Show this info @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \ | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[33m%-23s\033[0m %s\n", $$1, $$2}' @echo -e '' - @echo -e '\033[90mGenerated by GoMakeGen 1.3.0\033[0m\n' + @echo -e '\033[90mGenerated by GoMakeGen 1.5.1\033[0m\n' ################################################################################ diff --git a/README.md b/README.md index be0427b..b4f3523 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Tiny Redis client for latency measurement. Utility show `PING` command latency o #### From source -To build the `redis-latency-monitor` from scratch, make sure you have a working Go 1.16+ workspace (_[instructions](https://golang.org/doc/install)_), then: +To build the `redis-latency-monitor` from scratch, make sure you have a working Go 1.17+ workspace (_[instructions](https://golang.org/doc/install)_), then: ``` go get github.com/essentialkaos/redis-latency-monitor diff --git a/common/redis-latency-monitor.spec b/common/redis-latency-monitor.spec index 1177474..0ecce11 100644 --- a/common/redis-latency-monitor.spec +++ b/common/redis-latency-monitor.spec @@ -10,17 +10,17 @@ Summary: Tiny Redis client for latency measurement Name: redis-latency-monitor -Version: 3.2.0 +Version: 3.2.11 Release: 0%{?dist} Group: Applications/System License: Apache License, Version 2.0 -URL: https://github.com/essentialkaos/redis-latency-monitor +URL: https://kaos.sh/redis-latency-monitor Source0: https://source.kaos.st/%{name}/%{name}-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: golang >= 1.13 +BuildRequires: golang >= 1.17 Provides: %{name} = %{version}-%{release} @@ -86,6 +86,12 @@ fi ################################################################################ %changelog +* Wed Mar 30 2022 Anton Novojilov - 3.2.1-0 +- Package ek updated to the latest stable version +- Removed pkg.re usage +- Added module info +- Added Dependabot configuration + * Mon Oct 21 2019 Anton Novojilov - 3.2.0-0 - Improved UI diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..01928dd --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/essentialkaos/redis-latency-monitor + +go 1.17 + +require github.com/essentialkaos/ek/v12 v12.42.1 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..2a04230 --- /dev/null +++ b/go.sum @@ -0,0 +1,27 @@ +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/essentialkaos/check v1.2.1 h1:avvyFy/1acUNwfxwuOLsHeCjfXtMygtbu0lVDr3nxFs= +github.com/essentialkaos/check v1.2.1/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8= +github.com/essentialkaos/ek/v12 v12.42.1 h1:h3PPy0XNXUj1IsEid/p9IzaF0o5hZEGOBFh7XZawAyg= +github.com/essentialkaos/ek/v12 v12.42.1/go.mod h1:Cv/tOZshmFg4pMJnBkg4aW/WyYhzzc41qzZIfk5RSi4= +github.com/essentialkaos/go-linenoise/v3 v3.3.5/go.mod h1:g4X3LhT83XT4h7xwrCLclAdMkJvS9qWBQTGNdS6y4vo= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= diff --git a/redis-latency-monitor.go b/redis-latency-monitor.go index b7595a4..473eb0c 100644 --- a/redis-latency-monitor.go +++ b/redis-latency-monitor.go @@ -2,7 +2,7 @@ package main // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2020 ESSENTIAL KAOS // +// Copyright (c) 2022 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // @@ -17,17 +17,17 @@ import ( "strings" "time" - "pkg.re/essentialkaos/ek.v11/fmtc" - "pkg.re/essentialkaos/ek.v11/fmtutil" - "pkg.re/essentialkaos/ek.v11/fmtutil/table" - "pkg.re/essentialkaos/ek.v11/log" - "pkg.re/essentialkaos/ek.v11/mathutil" - "pkg.re/essentialkaos/ek.v11/options" - "pkg.re/essentialkaos/ek.v11/timeutil" - "pkg.re/essentialkaos/ek.v11/usage" - "pkg.re/essentialkaos/ek.v11/usage/completion/bash" - "pkg.re/essentialkaos/ek.v11/usage/completion/fish" - "pkg.re/essentialkaos/ek.v11/usage/completion/zsh" + "github.com/essentialkaos/ek/v12/fmtc" + "github.com/essentialkaos/ek/v12/fmtutil" + "github.com/essentialkaos/ek/v12/fmtutil/table" + "github.com/essentialkaos/ek/v12/log" + "github.com/essentialkaos/ek/v12/mathutil" + "github.com/essentialkaos/ek/v12/options" + "github.com/essentialkaos/ek/v12/timeutil" + "github.com/essentialkaos/ek/v12/usage" + "github.com/essentialkaos/ek/v12/usage/completion/bash" + "github.com/essentialkaos/ek/v12/usage/completion/fish" + "github.com/essentialkaos/ek/v12/usage/completion/zsh" "github.com/essentialkaos/redis-latency-monitor/stats" ) @@ -37,7 +37,7 @@ import ( // App info const ( APP = "Redis Latency Monitor" - VER = "3.2.0" + VER = "3.2.1" DESC = "Tiny Redis client for latency measurement" ) diff --git a/stats/stats.go b/stats/stats.go index 55308c1..6e25b2d 100644 --- a/stats/stats.go +++ b/stats/stats.go @@ -2,7 +2,7 @@ package stats // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2020 ESSENTIAL KAOS // +// Copyright (c) 2022 ESSENTIAL KAOS // // Apache License, Version 2.0 // // // // ////////////////////////////////////////////////////////////////////////////////// // From 7e5030ff772e3e48c8f16dc1bedac98c9d10bf19 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 30 Mar 2022 00:25:17 +0300 Subject: [PATCH 2/3] Fix spec --- common/redis-latency-monitor.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/redis-latency-monitor.spec b/common/redis-latency-monitor.spec index 0ecce11..efbec73 100644 --- a/common/redis-latency-monitor.spec +++ b/common/redis-latency-monitor.spec @@ -10,7 +10,7 @@ Summary: Tiny Redis client for latency measurement Name: redis-latency-monitor -Version: 3.2.11 +Version: 3.2.1 Release: 0%{?dist} Group: Applications/System License: Apache License, Version 2.0 From 5d29f3b897fd786f25871e989f2aa10c2022fd56 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Fri, 1 Apr 2022 01:19:03 +0300 Subject: [PATCH 3/3] Improve spec --- common/redis-latency-monitor.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/redis-latency-monitor.spec b/common/redis-latency-monitor.spec index efbec73..16211b7 100644 --- a/common/redis-latency-monitor.spec +++ b/common/redis-latency-monitor.spec @@ -37,7 +37,9 @@ or connection latency in milliseconds (one thousandth of a second). %build export GOPATH=$(pwd) -go build src/github.com/essentialkaos/%{name}/%{name}.go +pushd src/github.com/essentialkaos/%{name} + go build -mod vendor -o $GOPATH/%{name} %{name}.go +popd %install rm -rf %{buildroot}