From 19f85c3cec476f1f62d3e019ea324fd5805317c8 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Fri, 9 Feb 2024 23:02:39 +0100 Subject: [PATCH 1/2] Bump linter version --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 33ec76dc4..92fa34cbe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,7 +41,7 @@ variables: linter: stage: test - image: golangci/golangci-lint:v1.55.2 + image: golangci/golangci-lint:v1.56.1 script: - go mod download - golangci-lint run ./... From 7c3840fec13ff4280e1dfba8e53c208921c62734 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Fri, 9 Feb 2024 23:03:12 +0100 Subject: [PATCH 2/2] Delint: Remove unused parameters --- cmd/kivik/cmd/copy_test.go | 2 +- cmd/kivik/cmd/delete_attachment_test.go | 4 ++-- cmd/kivik/cmd/delete_config_test.go | 2 +- cmd/kivik/cmd/delete_db_test.go | 2 +- cmd/kivik/cmd/delete_doc_test.go | 4 ++-- cmd/kivik/cmd/delete_test.go | 8 ++++---- cmd/kivik/cmd/describe_attachment_test.go | 6 +++--- cmd/kivik/cmd/describe_doc_test.go | 8 ++++---- cmd/kivik/cmd/describe_test.go | 6 +++--- cmd/kivik/cmd/describe_version_test.go | 4 ++-- cmd/kivik/cmd/get_attachment_test.go | 6 +++--- cmd/kivik/cmd/get_cluster_setup_test.go | 4 ++-- cmd/kivik/cmd/get_databases_test.go | 2 +- cmd/kivik/cmd/get_security_test.go | 2 +- cmd/kivik/cmd/get_test.go | 18 +++++++++--------- cmd/kivik/cmd/get_version_test.go | 6 +++--- cmd/kivik/cmd/ping_test.go | 10 +++++----- cmd/kivik/cmd/post_cluster_setup_test.go | 4 ++-- cmd/kivik/cmd/put_config_test.go | 2 +- cmd/kivik/cmd/put_database_test.go | 2 +- cmd/kivik/cmd/put_security_test.go | 2 +- cmd/kivik/cmd/version_test.go | 4 ++-- couchdb/attachments_test.go | 2 +- couchdb/chttp/cookieauth_test.go | 2 +- couchdb/cluster_test.go | 4 ++-- couchdb/db_test.go | 20 ++++++++++---------- couchdb/replication_test.go | 2 +- couchdb/scheduler_test.go | 2 +- couchdb/test/session.go | 2 +- db_test.go | 4 ++-- kivik_test.go | 6 +++--- x/fsdb/get_test.go | 2 +- x/fsdb/revsdiff_test.go | 2 +- x/kivikd/couchserver/favicon.go | 2 +- x/kivikd/couchserver/root.go | 2 +- x/kivikd/logger_test.go | 4 ++-- x/server/db.go | 2 +- x/server/server.go | 2 +- x/server/utils.go | 4 ++-- 39 files changed, 86 insertions(+), 86 deletions(-) diff --git a/cmd/kivik/cmd/copy_test.go b/cmd/kivik/cmd/copy_test.go index cc2bbc7a8..bf446ad14 100644 --- a/cmd/kivik/cmd/copy_test.go +++ b/cmd/kivik/cmd/copy_test.go @@ -178,7 +178,7 @@ func Test_copy_RunE(t *testing.T) { args: []string{"--debug", "copy", ss.URL + "/asdf/src", ts.URL + "/qwerty/target?rev=7-qhk"}, } }) - tests.Add("from context", func(t *testing.T) interface{} { + tests.Add("from context", func(*testing.T) interface{} { return cmdTest{ args: []string{"--debug", "copy", "--config", "./testdata/copy.yaml", "--target", "target"}, status: errors.ErrUnavailable, diff --git a/cmd/kivik/cmd/delete_attachment_test.go b/cmd/kivik/cmd/delete_attachment_test.go index 2efd9508a..cb312698a 100644 --- a/cmd/kivik/cmd/delete_attachment_test.go +++ b/cmd/kivik/cmd/delete_attachment_test.go @@ -30,7 +30,7 @@ func Test_delete_attachment_RunE(t *testing.T) { args: []string{"delete", "attachment"}, status: errors.ErrUsage, }) - tests.Add("success", func(t *testing.T) interface{} { + tests.Add("success", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -45,7 +45,7 @@ func Test_delete_attachment_RunE(t *testing.T) { args: []string{"delete", "attachment", s.URL + "/db/doc/foo.txt", "-O", "rev=1-xxx"}, } }) - tests.Add("no rev", func(t *testing.T) interface{} { + tests.Add("no rev", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusConflict, Header: http.Header{ diff --git a/cmd/kivik/cmd/delete_config_test.go b/cmd/kivik/cmd/delete_config_test.go index dbc6c7ff7..7d10f9204 100644 --- a/cmd/kivik/cmd/delete_config_test.go +++ b/cmd/kivik/cmd/delete_config_test.go @@ -26,7 +26,7 @@ import ( func Test_delete_config_RunE(t *testing.T) { tests := testy.NewTable() - tests.Add("missing key", func(t *testing.T) interface{} { + tests.Add("missing key", func(*testing.T) interface{} { return cmdTest{ args: []string{"delete", "config", "http://example.com/foo/"}, status: errors.ErrUsage, diff --git a/cmd/kivik/cmd/delete_db_test.go b/cmd/kivik/cmd/delete_db_test.go index e18eb84e5..d1a940a6a 100644 --- a/cmd/kivik/cmd/delete_db_test.go +++ b/cmd/kivik/cmd/delete_db_test.go @@ -30,7 +30,7 @@ func Test_delete_db_RunE(t *testing.T) { args: []string{"delete", "database"}, status: errors.ErrUsage, }) - tests.Add("success", func(t *testing.T) interface{} { + tests.Add("success", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ diff --git a/cmd/kivik/cmd/delete_doc_test.go b/cmd/kivik/cmd/delete_doc_test.go index c8517dbe8..9c7ffc0a6 100644 --- a/cmd/kivik/cmd/delete_doc_test.go +++ b/cmd/kivik/cmd/delete_doc_test.go @@ -30,7 +30,7 @@ func Test_delete_doc_RunE(t *testing.T) { args: []string{"delete", "doc"}, status: errors.ErrUsage, }) - tests.Add("success", func(t *testing.T) interface{} { + tests.Add("success", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -45,7 +45,7 @@ func Test_delete_doc_RunE(t *testing.T) { args: []string{"delete", "doc", s.URL + "/db/doc", "-O", "rev=1-xxx"}, } }) - tests.Add("no rev", func(t *testing.T) interface{} { + tests.Add("no rev", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusConflict, Header: http.Header{ diff --git a/cmd/kivik/cmd/delete_test.go b/cmd/kivik/cmd/delete_test.go index c4aaa3ac3..4abf4247b 100644 --- a/cmd/kivik/cmd/delete_test.go +++ b/cmd/kivik/cmd/delete_test.go @@ -30,7 +30,7 @@ func Test_delete_RunE(t *testing.T) { args: []string{"delete"}, status: errors.ErrUsage, }) - tests.Add("auto delete doc", func(t *testing.T) interface{} { + tests.Add("auto delete doc", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -45,7 +45,7 @@ func Test_delete_RunE(t *testing.T) { args: []string{"delete", s.URL + "/db/doc", "-O", "rev=1-xxx"}, } }) - tests.Add("auto delete db", func(t *testing.T) interface{} { + tests.Add("auto delete db", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -59,7 +59,7 @@ func Test_delete_RunE(t *testing.T) { args: []string{"delete", s.URL + "/db"}, } }) - tests.Add("auto delete attachment", func(t *testing.T) interface{} { + tests.Add("auto delete attachment", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -74,7 +74,7 @@ func Test_delete_RunE(t *testing.T) { args: []string{"delete", s.URL + "/db/doc/filename.txt", "-O", "rev=1-xxx"}, } }) - tests.Add("auto delete config", func(t *testing.T) interface{} { + tests.Add("auto delete config", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ diff --git a/cmd/kivik/cmd/describe_attachment_test.go b/cmd/kivik/cmd/describe_attachment_test.go index f22f452bc..a28a71c4d 100644 --- a/cmd/kivik/cmd/describe_attachment_test.go +++ b/cmd/kivik/cmd/describe_attachment_test.go @@ -30,7 +30,7 @@ func Test_describe_attachment_RunE(t *testing.T) { args: []string{"descr", "attachment"}, status: errors.ErrUsage, }) - tests.Add("not found", func(t *testing.T) interface{} { + tests.Add("not found", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusNotFound, Header: http.Header{ @@ -45,7 +45,7 @@ func Test_describe_attachment_RunE(t *testing.T) { status: errors.ErrNotFound, } }) - tests.Add("success", func(t *testing.T) interface{} { + tests.Add("success", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -61,7 +61,7 @@ func Test_describe_attachment_RunE(t *testing.T) { args: []string{"descr", "attachment", s.URL + "/db/doc/foo.txt"}, } }) - tests.Add("success json", func(t *testing.T) interface{} { + tests.Add("success json", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ diff --git a/cmd/kivik/cmd/describe_doc_test.go b/cmd/kivik/cmd/describe_doc_test.go index 94247494f..ff8558152 100644 --- a/cmd/kivik/cmd/describe_doc_test.go +++ b/cmd/kivik/cmd/describe_doc_test.go @@ -24,7 +24,7 @@ import ( func Test_describe_doc_RunE(t *testing.T) { tests := testy.NewTable() - tests.Add("describe doc", func(t *testing.T) interface{} { + tests.Add("describe doc", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -43,7 +43,7 @@ func Test_describe_doc_RunE(t *testing.T) { args: []string{"describe", "doc", s.URL + "/foo/bar"}, } }) - tests.Add("describe doc json", func(t *testing.T) interface{} { + tests.Add("describe doc json", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -61,7 +61,7 @@ func Test_describe_doc_RunE(t *testing.T) { args: []string{"describe", "-f", "json", "doc", s.URL + "/foo/bar"}, } }) - tests.Add("describe doc header", func(t *testing.T) interface{} { + tests.Add("describe doc header", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -80,7 +80,7 @@ func Test_describe_doc_RunE(t *testing.T) { args: []string{"describe", "-H", "doc", s.URL + "/foo/bar"}, } }) - tests.Add("describe doc verbose", func(t *testing.T) interface{} { + tests.Add("describe doc verbose", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ diff --git a/cmd/kivik/cmd/describe_test.go b/cmd/kivik/cmd/describe_test.go index cedd94102..23a37fa52 100644 --- a/cmd/kivik/cmd/describe_test.go +++ b/cmd/kivik/cmd/describe_test.go @@ -24,7 +24,7 @@ import ( func Test_describe_RunE(t *testing.T) { tests := testy.NewTable() - tests.Add("auto describe doc", func(t *testing.T) interface{} { + tests.Add("auto describe doc", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -43,7 +43,7 @@ func Test_describe_RunE(t *testing.T) { args: []string{"describe", s.URL + "/foo/bar"}, } }) - tests.Add("auto describe version", func(t *testing.T) interface{} { + tests.Add("auto describe version", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -58,7 +58,7 @@ func Test_describe_RunE(t *testing.T) { args: []string{"describe", s.URL}, } }) - tests.Add("auto attachment", func(t *testing.T) interface{} { + tests.Add("auto attachment", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ diff --git a/cmd/kivik/cmd/describe_version_test.go b/cmd/kivik/cmd/describe_version_test.go index 5fb40a224..4c98adc9b 100644 --- a/cmd/kivik/cmd/describe_version_test.go +++ b/cmd/kivik/cmd/describe_version_test.go @@ -24,7 +24,7 @@ import ( func Test_describe_version_RunE(t *testing.T) { tests := testy.NewTable() - tests.Add("describe version", func(t *testing.T) interface{} { + tests.Add("describe version", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -39,7 +39,7 @@ func Test_describe_version_RunE(t *testing.T) { args: []string{"describe", "version", s.URL}, } }) - tests.Add("describe version json", func(t *testing.T) interface{} { + tests.Add("describe version json", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ diff --git a/cmd/kivik/cmd/get_attachment_test.go b/cmd/kivik/cmd/get_attachment_test.go index 7b6b1ea05..0e7138dc5 100644 --- a/cmd/kivik/cmd/get_attachment_test.go +++ b/cmd/kivik/cmd/get_attachment_test.go @@ -30,7 +30,7 @@ func Test_get_attachment_RunE(t *testing.T) { args: []string{"get", "attachment"}, status: errors.ErrUsage, }) - tests.Add("not found", func(t *testing.T) interface{} { + tests.Add("not found", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusNotFound, Header: http.Header{ @@ -45,7 +45,7 @@ func Test_get_attachment_RunE(t *testing.T) { status: errors.ErrNotFound, } }) - tests.Add("success", func(t *testing.T) interface{} { + tests.Add("success", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -60,7 +60,7 @@ func Test_get_attachment_RunE(t *testing.T) { args: []string{"get", "attachment", s.URL + "/db/doc/foo.txt"}, } }) - tests.Add("success json", func(t *testing.T) interface{} { + tests.Add("success json", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ diff --git a/cmd/kivik/cmd/get_cluster_setup_test.go b/cmd/kivik/cmd/get_cluster_setup_test.go index f927fe2cd..edc1229b1 100644 --- a/cmd/kivik/cmd/get_cluster_setup_test.go +++ b/cmd/kivik/cmd/get_cluster_setup_test.go @@ -30,7 +30,7 @@ func Test_get_clusterSetup_RunE(t *testing.T) { args: []string{"get", "cluster"}, status: errors.ErrUsage, }) - tests.Add("success", func(t *testing.T) interface{} { + tests.Add("success", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -45,7 +45,7 @@ func Test_get_clusterSetup_RunE(t *testing.T) { args: []string{"get", "cluster", s.URL}, } }) - tests.Add("success json", func(t *testing.T) interface{} { + tests.Add("success json", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ diff --git a/cmd/kivik/cmd/get_databases_test.go b/cmd/kivik/cmd/get_databases_test.go index 8bef9c7ee..7605b3a2b 100644 --- a/cmd/kivik/cmd/get_databases_test.go +++ b/cmd/kivik/cmd/get_databases_test.go @@ -24,7 +24,7 @@ import ( func Test_get_all_databases_RunE(t *testing.T) { tests := testy.NewTable() - tests.Add("get all-dbs", func(t *testing.T) interface{} { + tests.Add("get all-dbs", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ diff --git a/cmd/kivik/cmd/get_security_test.go b/cmd/kivik/cmd/get_security_test.go index 9c959ed26..a340e248f 100644 --- a/cmd/kivik/cmd/get_security_test.go +++ b/cmd/kivik/cmd/get_security_test.go @@ -30,7 +30,7 @@ func Test_get_sec_RunE(t *testing.T) { args: []string{"get", "sec"}, status: errors.ErrUsage, }) - tests.Add("success", func(t *testing.T) interface{} { + tests.Add("success", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ diff --git a/cmd/kivik/cmd/get_test.go b/cmd/kivik/cmd/get_test.go index cd656054a..b4649aa5d 100644 --- a/cmd/kivik/cmd/get_test.go +++ b/cmd/kivik/cmd/get_test.go @@ -50,7 +50,7 @@ func Test_get_RunE(t *testing.T) { args: []string{"--debug", "--config", "./testdata/localhost.yaml", "get", "bar"}, status: errors.ErrUnavailable, }) - tests.Add("not found", func(t *testing.T) interface{} { + tests.Add("not found", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusNotFound, }) @@ -60,7 +60,7 @@ func Test_get_RunE(t *testing.T) { status: errors.ErrNotFound, } }) - tests.Add("invalid JSON response", func(t *testing.T) interface{} { + tests.Add("invalid JSON response", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -75,7 +75,7 @@ func Test_get_RunE(t *testing.T) { status: errors.ErrProtocol, } }) - tests.Add("success", func(t *testing.T) interface{} { + tests.Add("success", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -93,7 +93,7 @@ func Test_get_RunE(t *testing.T) { args: []string{"get", s.URL + "/db/doc"}, } }) - tests.Add("get database", func(t *testing.T) interface{} { + tests.Add("get database", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -107,7 +107,7 @@ func Test_get_RunE(t *testing.T) { args: []string{"get", "database", s.URL + "/foo"}, } }) - tests.Add("auto get database", func(t *testing.T) interface{} { + tests.Add("auto get database", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -121,7 +121,7 @@ func Test_get_RunE(t *testing.T) { args: []string{"--debug", "get", s.URL + "/foo"}, } }) - tests.Add("describe database", func(t *testing.T) interface{} { + tests.Add("describe database", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -135,7 +135,7 @@ func Test_get_RunE(t *testing.T) { args: []string{"describe", "database", s.URL + "/foo"}, } }) - tests.Add("auto version", func(t *testing.T) interface{} { + tests.Add("auto version", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -150,7 +150,7 @@ func Test_get_RunE(t *testing.T) { args: []string{"get", s.URL}, } }) - tests.Add("auto attachment", func(t *testing.T) interface{} { + tests.Add("auto attachment", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -165,7 +165,7 @@ func Test_get_RunE(t *testing.T) { args: []string{"get", s.URL + "/db/doc/foo.txt"}, } }) - tests.Add("auto all-dbs", func(t *testing.T) interface{} { + tests.Add("auto all-dbs", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ diff --git a/cmd/kivik/cmd/get_version_test.go b/cmd/kivik/cmd/get_version_test.go index 6956feb80..2bb1f8555 100644 --- a/cmd/kivik/cmd/get_version_test.go +++ b/cmd/kivik/cmd/get_version_test.go @@ -26,7 +26,7 @@ import ( func Test_get_version_RunE(t *testing.T) { tests := testy.NewTable() - tests.Add("get version", func(t *testing.T) interface{} { + tests.Add("get version", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -41,7 +41,7 @@ func Test_get_version_RunE(t *testing.T) { args: []string{"get", "version", s.URL}, } }) - tests.Add("get version json", func(t *testing.T) interface{} { + tests.Add("get version json", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -56,7 +56,7 @@ func Test_get_version_RunE(t *testing.T) { args: []string{"get", "version", s.URL, "-f", "json"}, } }) - tests.Add("get version no url", func(t *testing.T) interface{} { + tests.Add("get version no url", func(*testing.T) interface{} { return cmdTest{ args: []string{"get", "version"}, status: errors.ErrUsage, diff --git a/cmd/kivik/cmd/ping_test.go b/cmd/kivik/cmd/ping_test.go index d7ce8508d..f31ae4415 100644 --- a/cmd/kivik/cmd/ping_test.go +++ b/cmd/kivik/cmd/ping_test.go @@ -30,14 +30,14 @@ func Test_ping_RunE(t *testing.T) { args: []string{"--debug", "ping", "http://localhost:1/foo/bar/%xxx"}, status: errors.ErrUsage, }) - tests.Add("full url on command line", func(t *testing.T) interface{} { + tests.Add("full url on command line", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{}) return cmdTest{ args: []string{"ping", s.URL}, } }) - tests.Add("server only on command line", func(t *testing.T) interface{} { + tests.Add("server only on command line", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ Body: io.NopCloser(strings.NewReader(`{"status":"ok"}`)), }) @@ -54,7 +54,7 @@ func Test_ping_RunE(t *testing.T) { args: []string{"ping", "http://localhost:9999/"}, status: errors.ErrUnavailable, }) - tests.Add("Couch 1.7, up", func(t *testing.T) interface{} { + tests.Add("Couch 1.7, up", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusBadRequest, Header: http.Header{ @@ -66,7 +66,7 @@ func Test_ping_RunE(t *testing.T) { args: []string{"ping", s.URL}, } }) - tests.Add("Couch 3.0, up", func(t *testing.T) interface{} { + tests.Add("Couch 3.0, up", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusOK, }) @@ -75,7 +75,7 @@ func Test_ping_RunE(t *testing.T) { args: []string{"ping", s.URL}, } }) - tests.Add("Couch 3.0, down", func(t *testing.T) interface{} { + tests.Add("Couch 3.0, down", func(*testing.T) interface{} { s := testy.ServeResponse(&http.Response{ StatusCode: http.StatusNotFound, }) diff --git a/cmd/kivik/cmd/post_cluster_setup_test.go b/cmd/kivik/cmd/post_cluster_setup_test.go index b1925536d..4b38a776e 100644 --- a/cmd/kivik/cmd/post_cluster_setup_test.go +++ b/cmd/kivik/cmd/post_cluster_setup_test.go @@ -27,13 +27,13 @@ import ( func Test_post_cluster_setup_RunE(t *testing.T) { tests := testy.NewTable() - tests.Add("missing dsn", func(t *testing.T) interface{} { + tests.Add("missing dsn", func(*testing.T) interface{} { return cmdTest{ args: []string{"post", "cluster-setup"}, status: errors.ErrUsage, } }) - tests.Add("no data", func(t *testing.T) interface{} { + tests.Add("no data", func(*testing.T) interface{} { return cmdTest{ args: []string{"post", "cluster-setup", "http://example.com"}, status: errors.ErrUsage, diff --git a/cmd/kivik/cmd/put_config_test.go b/cmd/kivik/cmd/put_config_test.go index e16f35587..394867cbe 100644 --- a/cmd/kivik/cmd/put_config_test.go +++ b/cmd/kivik/cmd/put_config_test.go @@ -26,7 +26,7 @@ import ( func Test_put_config_RunE(t *testing.T) { tests := testy.NewTable() - tests.Add("missing key", func(t *testing.T) interface{} { + tests.Add("missing key", func(*testing.T) interface{} { return cmdTest{ args: []string{"delete", "config", "http://example.com/foo/"}, status: errors.ErrUsage, diff --git a/cmd/kivik/cmd/put_database_test.go b/cmd/kivik/cmd/put_database_test.go index e9d35b68f..05d1068fa 100644 --- a/cmd/kivik/cmd/put_database_test.go +++ b/cmd/kivik/cmd/put_database_test.go @@ -33,7 +33,7 @@ func Test_put_database_RunE(t *testing.T) { tests.Add("success", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"status":"ok"}`)), - }, func(t *testing.T, req *http.Request) { + }, func(_ *testing.T, req *http.Request) { req.Body.Close() // nolint:errcheck }) diff --git a/cmd/kivik/cmd/put_security_test.go b/cmd/kivik/cmd/put_security_test.go index f6b6836d0..5f05bc8cf 100644 --- a/cmd/kivik/cmd/put_security_test.go +++ b/cmd/kivik/cmd/put_security_test.go @@ -27,7 +27,7 @@ import ( func Test_put_security_RunE(t *testing.T) { tests := testy.NewTable() - tests.Add("missing database", func(t *testing.T) interface{} { + tests.Add("missing database", func(*testing.T) interface{} { return cmdTest{ args: []string{"put", "security", "http://example.com/foo/"}, status: errors.ErrUsage, diff --git a/cmd/kivik/cmd/version_test.go b/cmd/kivik/cmd/version_test.go index 4633f4665..101614761 100644 --- a/cmd/kivik/cmd/version_test.go +++ b/cmd/kivik/cmd/version_test.go @@ -21,12 +21,12 @@ import ( func Test_version_RunE(t *testing.T) { tests := testy.NewTable() - tests.Add("version", func(t *testing.T) interface{} { + tests.Add("version", func(*testing.T) interface{} { return cmdTest{ args: []string{"version"}, } }) - tests.Add("version json", func(t *testing.T) interface{} { + tests.Add("version json", func(*testing.T) interface{} { return cmdTest{ args: []string{"version", "-f", "json"}, } diff --git a/couchdb/attachments_test.go b/couchdb/attachments_test.go index c281cc284..103cb0357 100644 --- a/couchdb/attachments_test.go +++ b/couchdb/attachments_test.go @@ -389,7 +389,7 @@ func TestGetAttachment(t *testing.T) { name: "1.6.1", id: "foo", filename: "foo.txt", - db: newCustomDB(func(req *http.Request) (*http.Response, error) { + db: newCustomDB(func(*http.Request) (*http.Response, error) { return &http.Response{ StatusCode: 200, Header: http.Header{ diff --git a/couchdb/chttp/cookieauth_test.go b/couchdb/chttp/cookieauth_test.go index bfc17dc4c..d9762c731 100644 --- a/couchdb/chttp/cookieauth_test.go +++ b/couchdb/chttp/cookieauth_test.go @@ -74,7 +74,7 @@ func TestCookieAuthAuthenticate(t *testing.T) { } }) tests.Add("cookie not set", func(t *testing.T) interface{} { - s := nettest.NewHTTPTestServer(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + s := nettest.NewHTTPTestServer(t, http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { h := w.Header() h.Set("Content-Type", "application/json") h.Set("Date", "Sat, 08 Sep 2018 15:49:29 GMT") diff --git a/couchdb/cluster_test.go b/couchdb/cluster_test.go index 78a12f1b6..89a6f1fe7 100644 --- a/couchdb/cluster_test.go +++ b/couchdb/cluster_test.go @@ -58,7 +58,7 @@ func TestClusterStatus(t *testing.T) { expected: "cluster_finished", }) tests.Add("invalid option", tst{ - client: newCustomClient(func(r *http.Request) (*http.Response, error) { + client: newCustomClient(func(*http.Request) (*http.Response, error) { return nil, nil }), options: kivik.Param(optionEnsureDBsExist, 1.0), @@ -205,7 +205,7 @@ func TestMembership(t *testing.T) { status: http.StatusBadGateway, err: `Get "?http://example.com/_membership"?: network error`, }) - tests.Add("success 2.3.1", func(t *testing.T) interface{} { + tests.Add("success 2.3.1", func(*testing.T) interface{} { return tt{ client: newTestClient(&http.Response{ StatusCode: http.StatusOK, diff --git a/couchdb/db_test.go b/couchdb/db_test.go index 32e7f7b76..6abca29f8 100644 --- a/couchdb/db_test.go +++ b/couchdb/db_test.go @@ -376,9 +376,9 @@ Content-Length: 86 }, }, }) - tests.Add("bug268 - complex id", func(t *testing.T) interface{} { + tests.Add("bug268 - complex id", func(*testing.T) interface{} { return tt{ - db: newCustomDB(func(req *http.Request) (*http.Response, error) { + db: newCustomDB(func(*http.Request) (*http.Response, error) { return nil, errors.New("success") }), id: "http://example.com/", @@ -386,9 +386,9 @@ Content-Length: 86 err: `Get "?http://example.com/testdb/http%3A%2F%2Fexample\.com%2F"?: success`, } }) - tests.Add("plus sign", func(t *testing.T) interface{} { + tests.Add("plus sign", func(*testing.T) interface{} { return tt{ - db: newCustomDB(func(req *http.Request) (*http.Response, error) { + db: newCustomDB(func(*http.Request) (*http.Response, error) { return nil, errors.New("success") }), id: "2020-01-30T13:33:00.00+05:30|kl", @@ -470,9 +470,9 @@ func TestOpenRevs(t *testing.T) { } tests := testy.NewTable() - tests.Add("open_revs", func(t *testing.T) interface{} { + tests.Add("open_revs", func(*testing.T) interface{} { return tt{ - db: newCustomDB(func(req *http.Request) (*http.Response, error) { + db: newCustomDB(func(*http.Request) (*http.Response, error) { return &http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -495,9 +495,9 @@ Content-Type: application/json }, } }) - tests.Add("open_revs with multiple revs", func(t *testing.T) interface{} { + tests.Add("open_revs with multiple revs", func(*testing.T) interface{} { return tt{ - db: newCustomDB(func(req *http.Request) (*http.Response, error) { + db: newCustomDB(func(*http.Request) (*http.Response, error) { return &http.Response{ StatusCode: http.StatusOK, Header: http.Header{ @@ -601,9 +601,9 @@ Content-Type: application/json; error="true" }, } }) - tests.Add("not found", func(t *testing.T) interface{} { + tests.Add("not found", func(*testing.T) interface{} { return tt{ - db: newCustomDB(func(req *http.Request) (*http.Response, error) { + db: newCustomDB(func(*http.Request) (*http.Response, error) { return &http.Response{ StatusCode: http.StatusNotFound, Header: http.Header{ diff --git a/couchdb/replication_test.go b/couchdb/replication_test.go index 5c61c1ece..41a428a2e 100644 --- a/couchdb/replication_test.go +++ b/couchdb/replication_test.go @@ -195,7 +195,7 @@ func TestReplicate(t *testing.T) { name: "1.6.1", target: "foo", source: "bar", client: func() *client { - client := newCustomClient(func(req *http.Request) (*http.Response, error) { + client := newCustomClient(func(*http.Request) (*http.Response, error) { return &http.Response{ StatusCode: 201, Header: http.Header{ diff --git a/couchdb/scheduler_test.go b/couchdb/scheduler_test.go index fc2493474..e57d2ac39 100644 --- a/couchdb/scheduler_test.go +++ b/couchdb/scheduler_test.go @@ -516,7 +516,7 @@ func TestSRinnerUpdate(t *testing.T) { docID: "foo", db: func() *db { var count int - db := newCustomDB(func(req *http.Request) (*http.Response, error) { + db := newCustomDB(func(*http.Request) (*http.Response, error) { if count == 0 { count++ return &http.Response{ diff --git a/couchdb/test/session.go b/couchdb/test/session.go index 3f516e16d..4911a0874 100644 --- a/couchdb/test/session.go +++ b/couchdb/test/session.go @@ -117,7 +117,7 @@ func testCreateSession(ctx *kt.Context, client *chttp.Client) { // Re-create client, so we can override defaults client, _ = chttp.New(&http.Client{}, client.DSN(), mock.NilOption) // Don't follow redirect - client.CheckRedirect = func(req *http.Request, via []*http.Request) error { + client.CheckRedirect = func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse } var name, password string diff --git a/db_test.go b/db_test.go index f702541e7..1278fd9ae 100644 --- a/db_test.go +++ b/db_test.go @@ -2968,7 +2968,7 @@ func TestRevsDiff(t *testing.T) { db: &DB{ client: &Client{}, driverDB: &mock.RevsDiffer{ - RevsDiffFunc: func(_ context.Context, revMap interface{}) (driver.Rows, error) { + RevsDiffFunc: func(context.Context, interface{}) (driver.Rows, error) { return nil, errors.New("net error") }, }, @@ -2980,7 +2980,7 @@ func TestRevsDiff(t *testing.T) { db: &DB{ client: &Client{}, driverDB: &mock.RevsDiffer{ - RevsDiffFunc: func(_ context.Context, revMap interface{}) (driver.Rows, error) { + RevsDiffFunc: func(context.Context, interface{}) (driver.Rows, error) { return &mock.Rows{ID: "a"}, nil }, }, diff --git a/kivik_test.go b/kivik_test.go index c156a07fb..8706bea32 100644 --- a/kivik_test.go +++ b/kivik_test.go @@ -404,7 +404,7 @@ func TestCreateDB(t *testing.T) { } return nil }, - DBFunc: func(dbName string, _ driver.Options) (driver.DB, error) { + DBFunc: func(string, driver.Options) (driver.DB, error) { return &mock.DB{ID: "abc"}, nil }, }, @@ -574,7 +574,7 @@ func TestDBsStats(t *testing.T) { name: "native success", client: &Client{ driverClient: &mock.DBsStatser{ - DBsStatsFunc: func(_ context.Context, names []string) ([]*driver.DBStats, error) { + DBsStatsFunc: func(context.Context, []string) ([]*driver.DBStats, error) { return []*driver.DBStats{ {Name: "foo", DiskSize: 123}, {Name: "bar", DiskSize: 321}, @@ -592,7 +592,7 @@ func TestDBsStats(t *testing.T) { name: "native error", client: &Client{ driverClient: &mock.DBsStatser{ - DBsStatsFunc: func(_ context.Context, names []string) ([]*driver.DBStats, error) { + DBsStatsFunc: func(context.Context, []string) ([]*driver.DBStats, error) { return nil, errors.New("native failure") }, }, diff --git a/x/fsdb/get_test.go b/x/fsdb/get_test.go index e639faaaa..b95d6ace5 100644 --- a/x/fsdb/get_test.go +++ b/x/fsdb/get_test.go @@ -52,7 +52,7 @@ func TestGet(t *testing.T) { status: http.StatusNotFound, err: `^missing$`, }) - tests.Add("forbidden", func(t *testing.T) interface{} { + tests.Add("forbidden", func(*testing.T) interface{} { return tt{ fs: &filesystem.MockFS{ OpenFunc: func(_ string) (filesystem.File, error) { diff --git a/x/fsdb/revsdiff_test.go b/x/fsdb/revsdiff_test.go index 3438ac5a8..abd44d849 100644 --- a/x/fsdb/revsdiff_test.go +++ b/x/fsdb/revsdiff_test.go @@ -57,7 +57,7 @@ func TestRevsDiff(t *testing.T) { "newdoc": {"1-asdf"}, }, }) - tests.Add("cancelled context", func(t *testing.T) interface{} { + tests.Add("cancelled context", func(*testing.T) interface{} { ctx, cancel := context.WithCancel(context.Background()) cancel() return tt{ diff --git a/x/kivikd/couchserver/favicon.go b/x/kivikd/couchserver/favicon.go index f93ab78f0..d50c4a679 100644 --- a/x/kivikd/couchserver/favicon.go +++ b/x/kivikd/couchserver/favicon.go @@ -29,7 +29,7 @@ var files embed.FS // GetFavicon serves GET /favicon.ico func (h *Handler) GetFavicon() http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { + return func(w http.ResponseWriter, _ *http.Request) { var ico io.Reader if h.Favicon == "" { asset, err := files.Open("files/favicon.ico") diff --git a/x/kivikd/couchserver/root.go b/x/kivikd/couchserver/root.go index 1bd008ce7..dc5f5a1b9 100644 --- a/x/kivikd/couchserver/root.go +++ b/x/kivikd/couchserver/root.go @@ -22,7 +22,7 @@ import ( // GetRoot handles requests for: GET / func (h *Handler) GetRoot() http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { + return func(w http.ResponseWriter, _ *http.Request) { compatVer, vendName, vendVers := h.vendor() w.Header().Set("Content-Type", typeJSON) h.HandleError(w, json.NewEncoder(w).Encode(serverInfo{ diff --git a/x/kivikd/logger_test.go b/x/kivikd/logger_test.go index 4e53ab56e..11c1dd8d9 100644 --- a/x/kivikd/logger_test.go +++ b/x/kivikd/logger_test.go @@ -37,7 +37,7 @@ func TestLogger(t *testing.T) { ctx := context.WithValue(req.Context(), SessionKey, &session) req = req.WithContext(ctx) w := httptest.NewRecorder() - handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + handler := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusUnauthorized) _, _ = w.Write([]byte("Go away!")) }) @@ -58,7 +58,7 @@ func TestLoggerNoAuth(t *testing.T) { ctx := context.WithValue(req.Context(), SessionKey, &session) req = req.WithContext(ctx) w := httptest.NewRecorder() - handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + handler := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusUnauthorized) _, _ = w.Write([]byte("Go away!")) }) diff --git a/x/server/db.go b/x/server/db.go index 41bcea0af..af78cb21c 100644 --- a/x/server/db.go +++ b/x/server/db.go @@ -275,7 +275,7 @@ func (s *Server) query() httpe.HandlerWithError { } } else { viewFunc = func(ctx context.Context, opts ...kivik.Option) *kivik.ResultSet { - return s.client.DB(db).Query(ctx, ddoc, view, options(r)) + return s.client.DB(db).Query(ctx, ddoc, view, opts...) } } rows := viewFunc(r.Context(), options(r)) diff --git a/x/server/server.go b/x/server/server.go index 10af7ce7d..624bc7911 100644 --- a/x/server/server.go +++ b/x/server/server.go @@ -256,7 +256,7 @@ func serveJSON(w http.ResponseWriter, status int, payload interface{}) error { } func (s *Server) notImplemented() httpe.HandlerWithError { - return httpe.HandlerWithErrorFunc(func(w http.ResponseWriter, r *http.Request) error { + return httpe.HandlerWithErrorFunc(func(http.ResponseWriter, *http.Request) error { return errNotImplimented }) } diff --git a/x/server/utils.go b/x/server/utils.go index 689a86245..fd535367f 100644 --- a/x/server/utils.go +++ b/x/server/utils.go @@ -24,7 +24,7 @@ import ( ) func (s *Server) root() httpe.HandlerWithError { - return httpe.HandlerWithErrorFunc(func(w http.ResponseWriter, r *http.Request) error { + return httpe.HandlerWithErrorFunc(func(w http.ResponseWriter, _ *http.Request) error { return serveJSON(w, http.StatusOK, map[string]interface{}{ "couchdb": "Welcome", "vendor": map[string]string{ @@ -37,7 +37,7 @@ func (s *Server) root() httpe.HandlerWithError { } func (s *Server) up() httpe.HandlerWithError { - return httpe.HandlerWithErrorFunc(func(w http.ResponseWriter, r *http.Request) error { + return httpe.HandlerWithErrorFunc(func(w http.ResponseWriter, _ *http.Request) error { return serveJSON(w, http.StatusOK, map[string]interface{}{ "status": "ok", })