From 0afe1a355e9eee0c850449286ad82918d8c39c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandor=20Sz=C3=BCcs?= Date: Tue, 7 May 2024 21:17:59 +0200 Subject: [PATCH] add linters go vet and staticcheck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: staticcheck S1021 fix: https://github.com/valkey-io/valkey-go/issues/6 Signed-off-by: Sandor Szücs --- dockertest.sh | 13 +++++++++++++ valkeycompat/adapter.go | 3 +-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dockertest.sh b/dockertest.sh index 4648f04..1d05eed 100755 --- a/dockertest.sh +++ b/dockertest.sh @@ -2,6 +2,19 @@ set -ev +go vet ./... + +go install honnef.co/go/tools/cmd/staticcheck@latest +# disabled checks +# -ST1000 missing package doc in internal packages +# -ST1003 wrong naming convention would require breaking changes +# -ST1012 wrong error name convention in om package would require breaking changes +# -ST1016 violation of methods on the same type should have the same receiver name in valkeyhook +# -ST1020 violation of go doc comment on exported methods in valkeycompat +# -ST1021 violation of go doc comment on exported types in valkeycompat +# -U1000 unused check in mock package +staticcheck -checks "all,-ST1000,-ST1003,-ST1012,-ST1016,-ST1020,-ST1021,-U1000" ./... | (grep -v "_test.go:" && exit 1 || exit 0) + trap "docker-compose down -v" EXIT docker-compose up -d sleep 5 diff --git a/valkeycompat/adapter.go b/valkeycompat/adapter.go index 930718f..a3ce67e 100644 --- a/valkeycompat/adapter.go +++ b/valkeycompat/adapter.go @@ -707,8 +707,7 @@ func (c *Compat) Keys(ctx context.Context, pattern string) *StringSliceCmd { } func (c *Compat) Migrate(ctx context.Context, host string, port int64, key string, db int64, timeout time.Duration) *StatusCmd { - var cmd valkey.Completed - cmd = c.client.B().Migrate().Host(host).Port(port).Key(key).DestinationDb(db).Timeout(formatSec(timeout)).Build() + cmd := c.client.B().Migrate().Host(host).Port(port).Key(key).DestinationDb(db).Timeout(formatSec(timeout)).Build() resp := c.client.Do(ctx, cmd) return newStatusCmd(resp) }