From 3dfaa88bb48c3cfc0f199bc2b33f2d83782a5d11 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Tue, 17 Jan 2023 13:16:58 +0200 Subject: [PATCH] kvdb/postgres: remove old +build directive and cleanup Due to the update of the kvdb package to go1.18, the `// +build` directives are no longer required. They are removed in this commit in order to simplify upcoming commits. Along the way, a few typos are fixed and an unused struct is removed. --- kvdb/postgres/db.go | 11 ++--------- kvdb/postgres/db_test.go | 1 - kvdb/postgres/driver.go | 1 - kvdb/postgres/fixture.go | 1 - kvdb/postgres/no_db.go | 1 - kvdb/postgres/readwrite_bucket.go | 1 - kvdb/postgres/readwrite_cursor.go | 1 - kvdb/postgres/readwrite_tx.go | 1 - 8 files changed, 2 insertions(+), 16 deletions(-) diff --git a/kvdb/postgres/db.go b/kvdb/postgres/db.go index 33dc98035..aa517e652 100644 --- a/kvdb/postgres/db.go +++ b/kvdb/postgres/db.go @@ -1,5 +1,4 @@ //go:build kvdb_postgres -// +build kvdb_postgres package postgres @@ -21,13 +20,7 @@ const ( kvTableName = "kv" ) -// KV stores a key/value pair. -type KV struct { - key string - val string -} - -// db holds a reference to the postgres connection connection. +// db holds a reference to the postgres connection. type db struct { // cfg is the postgres connection config. cfg *Config @@ -76,7 +69,7 @@ func Init(maxConnections int) { } // newPostgresBackend returns a db object initialized with the passed backend -// config. If postgres connection cannot be estabished, then returns error. +// config. If postgres connection cannot be established, then returns error. func newPostgresBackend(ctx context.Context, config *Config, prefix string) ( *db, error) { diff --git a/kvdb/postgres/db_test.go b/kvdb/postgres/db_test.go index 84c2b6503..d397223d1 100644 --- a/kvdb/postgres/db_test.go +++ b/kvdb/postgres/db_test.go @@ -1,5 +1,4 @@ //go:build kvdb_postgres -// +build kvdb_postgres package postgres diff --git a/kvdb/postgres/driver.go b/kvdb/postgres/driver.go index 1792eb652..4bc22052f 100644 --- a/kvdb/postgres/driver.go +++ b/kvdb/postgres/driver.go @@ -1,5 +1,4 @@ //go:build kvdb_postgres -// +build kvdb_postgres package postgres diff --git a/kvdb/postgres/fixture.go b/kvdb/postgres/fixture.go index 94356c31a..c7e2b014f 100644 --- a/kvdb/postgres/fixture.go +++ b/kvdb/postgres/fixture.go @@ -1,5 +1,4 @@ //go:build kvdb_postgres -// +build kvdb_postgres package postgres diff --git a/kvdb/postgres/no_db.go b/kvdb/postgres/no_db.go index edac449e4..aa49471ae 100644 --- a/kvdb/postgres/no_db.go +++ b/kvdb/postgres/no_db.go @@ -1,5 +1,4 @@ //go:build !kvdb_postgres -// +build !kvdb_postgres package postgres diff --git a/kvdb/postgres/readwrite_bucket.go b/kvdb/postgres/readwrite_bucket.go index 933769919..f71db50bd 100644 --- a/kvdb/postgres/readwrite_bucket.go +++ b/kvdb/postgres/readwrite_bucket.go @@ -1,5 +1,4 @@ //go:build kvdb_postgres -// +build kvdb_postgres package postgres diff --git a/kvdb/postgres/readwrite_cursor.go b/kvdb/postgres/readwrite_cursor.go index 80e321e06..67c1a39ae 100644 --- a/kvdb/postgres/readwrite_cursor.go +++ b/kvdb/postgres/readwrite_cursor.go @@ -1,5 +1,4 @@ //go:build kvdb_postgres -// +build kvdb_postgres package postgres diff --git a/kvdb/postgres/readwrite_tx.go b/kvdb/postgres/readwrite_tx.go index e0c3e2371..592128ad6 100644 --- a/kvdb/postgres/readwrite_tx.go +++ b/kvdb/postgres/readwrite_tx.go @@ -1,5 +1,4 @@ //go:build kvdb_postgres -// +build kvdb_postgres package postgres