From 5015297d409520bd84ea69eb2a2507ee31d9aaa5 Mon Sep 17 00:00:00 2001 From: Sam Arnold Date: Mon, 13 Sep 2021 15:12:35 -0400 Subject: [PATCH] fix: more expressive errors (#22448) * fix: more expressive errors Closes #22446 * fix: server only logging for untyped errors * chore: fix formatting --- authorization/http_client.go | 3 +-- authorization/http_server.go | 5 ++--- authorization/http_server_test.go | 7 +++---- authorization/middleware_auth.go | 5 ++--- authorization/middleware_auth_test.go | 4 ++-- authorization/middleware_logging.go | 3 +-- authorization/middleware_metrics.go | 3 +-- authorization/mock_tenant.go | 3 +-- authorization/service.go | 3 +-- authorization/storage.go | 1 - authorization/storage_authorization.go | 5 ++--- authorization/storage_authorization_test.go | 2 +- authorizer/agent.go | 3 +-- authorizer/agent_test.go | 2 +- authorizer/auth.go | 3 +-- authorizer/auth_test.go | 4 ++-- authorizer/authorize.go | 5 ++--- authorizer/bucket.go | 3 +-- authorizer/bucket_test.go | 4 ++-- authorizer/check_test.go | 4 ++-- authorizer/dashboard.go | 3 +-- authorizer/dashboard_test.go | 4 ++-- authorizer/document.go | 3 +-- authorizer/label.go | 3 +-- authorizer/label_test.go | 4 ++-- authorizer/notification_endpoint.go | 3 +-- authorizer/notification_endpoint_test.go | 4 ++-- authorizer/notification_rule.go | 3 +-- authorizer/notification_rule_test.go | 4 ++-- authorizer/org.go | 3 +-- authorizer/org_test.go | 4 ++-- authorizer/password.go | 3 +-- authorizer/password_test.go | 2 +- authorizer/restore.go | 3 +-- authorizer/scraper.go | 3 +-- authorizer/scraper_test.go | 4 ++-- authorizer/secret.go | 3 +-- authorizer/secret_test.go | 4 ++-- authorizer/source.go | 3 +-- authorizer/source_test.go | 4 ++-- authorizer/sql_backup_restore_test.go | 5 ++--- authorizer/telegraf.go | 3 +-- authorizer/telegraf_test.go | 4 ++-- authorizer/urm.go | 3 +-- authorizer/urm_test.go | 4 ++-- authorizer/user.go | 3 +-- authorizer/user_test.go | 4 ++-- authorizer/variable.go | 3 +-- authorizer/variable_test.go | 4 ++-- bolt/bbolt.go | 3 +-- bolt/id.go | 1 - bolt/id_test.go | 2 +- cmd/influxd/inspect/build_tsi/build_tsi.go | 3 +-- cmd/influxd/inspect/export_lp/export_lp.go | 3 +-- cmd/influxd/launcher/engine.go | 3 +-- cmd/influxd/launcher/launcher.go | 13 ++++++++---- cmd/influxd/launcher/print_config_test.go | 3 +-- cmd/influxd/launcher/query_test.go | 3 +-- cmd/influxd/upgrade/security.go | 3 +-- cmd/influxd/upgrade/security_test.go | 3 +-- context/token.go | 3 +-- context/token_test.go | 2 +- dashboards/service.go | 5 ++--- dashboards/testing/dashboards.go | 5 ++--- dashboards/testing/util.go | 3 +-- dashboards/transport/http.go | 5 ++--- dbrp/bucket_service.go | 3 +-- dbrp/http_client_dbrp.go | 3 +-- dbrp/http_client_dbrp_test.go | 2 +- dbrp/http_server_dbrp.go | 5 ++--- dbrp/middleware_auth.go | 3 +-- dbrp/middleware_auth_test.go | 4 ++-- dbrp/mocks/bucket_service.go | 3 ++- dbrp/mocks/dbrp_mapping_service.go | 3 ++- dbrp/service.go | 3 +-- fluxinit/init.go | 5 +++-- gather/metrics.go | 3 +-- gather/scraper_test.go | 3 +-- http/api_handler_test.go | 2 +- http/auth_service.go | 5 ++--- http/auth_test.go | 17 +++++++-------- http/authentication_middleware.go | 3 +-- http/authentication_test.go | 6 +++--- http/backup_service.go | 5 ++--- http/backup_service_test.go | 3 ++- http/check_test.go | 10 ++++----- http/delete_handler.go | 5 ++--- http/delete_test.go | 9 ++++---- http/document_service.go | 5 ++--- http/document_service_test.go | 2 +- http/document_test.go | 5 ++--- http/errors.go | 1 - http/errors_test.go | 5 +++-- http/handler.go | 3 +-- http/influxdb/source_proxy_query_service.go | 3 +-- http/label_service.go | 5 ++--- http/label_test.go | 17 +++++++-------- http/legacy/backend.go | 3 +-- http/legacy/common.go | 3 +-- .../legacy/influx1x_authentication_handler.go | 3 +-- .../influx1x_authentication_handler_test.go | 6 +++--- http/legacy/influxql_handler.go | 3 +-- http/legacy/influxqld_handler.go | 3 +-- http/legacy/influxqld_handler_test.go | 5 ++--- http/legacy/router.go | 3 +-- http/legacy/write_handler.go | 5 ++--- http/legacy/write_handler_test.go | 15 ++++++------- http/legacy/write_usage_recorder.go | 3 +-- http/mocks/bucket_service.go | 2 +- http/mocks/dbrp_mapping_service.go | 2 +- http/mocks/organization_service.go | 2 +- http/mocks/points_writer.go | 2 +- http/notification_endpoint.go | 5 ++--- http/notification_endpoint_test.go | 15 +++++++------ http/points/points_parser.go | 3 +-- http/query_handler_test.go | 14 ++++++------- http/query_test.go | 3 +-- http/requests.go | 3 +-- http/requests_test.go | 3 +-- http/restore_service.go | 7 +++---- http/router.go | 3 +-- http/router_test.go | 6 +++--- http/scraper_service.go | 5 ++--- http/scraper_service_test.go | 17 +++++++-------- http/session_handler.go | 3 +-- http/session_test.go | 3 +-- http/source_service.go | 5 ++--- http/source_service_test.go | 3 +-- http/task_service_test.go | 12 +++++------ http/telegraf.go | 5 ++--- http/telegraf_test.go | 3 +-- http/user_resource_mapping_service.go | 5 ++--- http/user_resource_mapping_test.go | 3 +-- http/user_service.go | 5 ++--- http/user_test.go | 7 +++---- http/variable_service.go | 5 ++--- http/variable_test.go | 21 +++++++++---------- http/write_handler.go | 5 ++--- http/write_handler_test.go | 9 +++----- http/write_usage_recorder.go | 3 +-- influxql/query/executor.go | 3 +-- influxql/query/iterator.go | 3 +-- influxql/query/proxy_executor.go | 3 +-- influxql/query/select.go | 3 +-- influxql/query_request.go | 3 +-- inmem/service.go | 3 +-- inmem/source.go | 3 +-- jsonweb/token.go | 3 +-- jsonweb/token_test.go | 3 +-- kit/cli/viper.go | 1 - kit/metric/client.go | 1 - kit/platform/errors/errors_test.go | 3 ++- kit/platform/id_test.go | 2 +- kit/tracing/tracing.go | 5 ++--- kit/transport/http/api.go | 1 - kit/transport/http/api_test.go | 2 +- kit/transport/http/error_handler.go | 14 ++++++++++--- kit/transport/http/error_handler_test.go | 7 ++++--- kit/transport/http/middleware.go | 3 +-- kv/document.go | 3 +-- kv/kvlog.go | 3 +-- kv/migration/all/0003_task_owners_test.go | 1 - .../all/0011_populate-dashboards-owner-id.go | 3 +-- .../0013_repair-DBRP-owner-and-bucket-IDs.go | 1 - ...hard-group-durations-in-bucket-metadata.go | 1 - ...group-durations-in-bucket-metadata_test.go | 3 +-- kv/migration/migration.go | 1 - kv/mock/bucket.go | 3 ++- kv/mock/forward_cursor.go | 3 ++- kv/mock/tx.go | 3 ++- kv/scrapers.go | 3 +-- kv/source.go | 3 +-- kv/store_base.go | 1 - kv/store_index.go | 3 +-- kv/variable.go | 3 +-- label/http_client.go | 3 +-- label/http_handler.go | 5 ++--- label/http_server.go | 3 +-- label/http_server_test.go | 5 ++--- label/middleware_auth.go | 3 +-- label/middleware_auth_test.go | 5 ++--- label/middleware_logging.go | 3 +-- label/middleware_metrics.go | 3 +-- label/middleware_metrics_test.go | 3 +-- label/service.go | 3 +-- label/storage.go | 1 - label/storage_label.go | 3 +-- label/storage_test.go | 2 +- label_test.go | 2 +- mock/annotation_service.go | 3 ++- mock/auth_service.go | 3 +-- mock/bucket_service.go | 3 +-- mock/check_service.go | 3 +-- mock/dashboard_service.go | 3 +-- mock/dbrp_mapping.go | 3 +-- mock/delete.go | 3 +-- mock/document_service.go | 3 +-- mock/label_service.go | 3 +-- mock/lookup_service.go | 3 +-- mock/notification_endpoint_service.go | 3 +-- mock/notification_rule_store.go | 3 +-- mock/operation_log_service.go | 3 +-- mock/org_service.go | 3 +-- mock/passwords_service.go | 3 ++- mock/points_writer.go | 1 - mock/scraper_service.go | 3 +-- mock/source_service.go | 3 +-- mock/telegraf_service.go | 3 +-- mock/user_resource_mapping_service.go | 3 +-- mock/user_service.go | 3 +-- mock/variable_service.go | 3 +-- notification/check/check_test.go | 9 ++++---- notification/endpoint/endpoint.go | 3 +-- notification/endpoint/endpoint_test.go | 2 +- notification/endpoint/http.go | 3 +-- notification/endpoint/pagerduty.go | 3 +-- notification/endpoint/service/service.go | 3 +-- notification/endpoint/service/store.go | 3 +-- .../endpoint/service/testing/service.go | 5 ++--- notification/endpoint/slack.go | 3 +-- notification/endpoint/telegram.go | 3 +-- notification/endpoint/testing/service.go | 5 ++--- notification/rule/http_test.go | 7 +++---- notification/rule/pagerduty.go | 5 ++--- notification/rule/rule.go | 5 ++--- notification/rule/rule_test.go | 2 +- notification/rule/slack.go | 5 ++--- notification/rule/slack_test.go | 3 +-- notification/rule/telegram.go | 5 ++--- notification/rule/telegram_test.go | 3 +-- pkg/httpc/req.go | 1 - pkg/jsonnet/decode_test.go | 3 +-- pkg/jsonparser/jsonparser_test.go | 2 +- pkger/http_remote_service.go | 3 +-- pkger/http_server_stack.go | 5 ++--- pkger/http_server_stack_test.go | 4 ++-- pkger/http_server_template.go | 5 ++--- pkger/http_server_template_test.go | 5 ++--- pkger/models.go | 3 +-- pkger/parser.go | 3 +-- pkger/service_auth.go | 3 +-- pkger/service_logging.go | 1 - pkger/service_metrics.go | 3 +-- pkger/service_tracing.go | 1 - pkger/store.go | 1 - pkger/store_test.go | 7 +++---- pprof/http_server.go | 3 +-- predicate/logical.go | 1 - predicate/parser.go | 3 +-- predicate/parser_test.go | 3 +-- predicate/tag_rule.go | 3 +-- prometheus/auth_service.go | 3 +-- prometheus/auth_service_test.go | 2 +- query/bridges.go | 3 +-- query/control/controller.go | 3 +-- query/dependency.go | 3 +-- query/dependency_test.go | 2 +- query/influxql/end_to_end_test.go | 2 +- query/influxql/service.go | 1 - query/influxql/spectests/testing.go | 7 +++---- query/influxql/transpiler.go | 3 +-- query/influxql/transpiler_test.go | 2 +- query/logger.go | 3 +-- query/logging_test.go | 2 +- query/request.go | 3 +-- query/stdlib/influxdata/influxdb/buckets.go | 3 +-- query/stdlib/influxdata/influxdb/metrics.go | 1 - query/stdlib/influxdata/influxdb/operators.go | 3 +-- query/stdlib/influxdata/influxdb/source.go | 3 +-- query/stdlib/influxdata/influxdb/storage.go | 1 - .../influxdata/influxdb/v1/databases.go | 5 ++--- query/stdlib/testing/end_to_end_test.go | 5 +++-- query/storage.go | 3 +-- resource/resource.go | 3 +-- secret/http_client.go | 1 - secret/http_server.go | 5 ++--- secret/http_server_test.go | 5 ++--- secret/middleware_auth.go | 3 +-- secret/middleware_auth_test.go | 4 ++-- secret/middleware_logging.go | 3 +-- secret/middleware_metrics.go | 3 +-- secret/service.go | 1 - secret/storage.go | 3 +-- session/http_server.go | 3 +-- session/http_server_test.go | 3 +-- session/service.go | 3 +-- session/storage.go | 3 +-- snowflake/id.go | 1 - sqlite/sqlite.go | 1 - storage/bucket_service.go | 3 +-- storage/bucket_service_test.go | 2 +- storage/engine.go | 5 ++--- storage/flux/reader.go | 3 +-- storage/mocks/EngineSchema.go | 2 +- storage/points_writer.go | 3 +-- tag_test.go | 2 +- .../executor/mock/permission_service.go | 3 ++- task/backend/executor/support_test.go | 3 +-- task/backend/scheduler/scheduler_test.go | 3 +-- telegraf.go | 3 +-- telegraf/service/telegraf.go | 3 +-- telegraf/service/testing/testing.go | 5 ++--- telegraf_test.go | 5 ++--- telemetry/handler.go | 3 +-- tenant/error_org.go | 3 +-- tenant/http_client_bucket.go | 3 +-- tenant/http_client_org.go | 3 +-- tenant/http_client_urm.go | 3 +-- tenant/http_client_user.go | 3 +-- tenant/http_handler_urm.go | 5 ++--- tenant/http_handler_urm_test.go | 2 +- tenant/http_server_bucket.go | 5 ++--- tenant/http_server_org.go | 3 +-- tenant/http_server_user.go | 5 ++--- tenant/middleware_bucket_auth.go | 3 +-- tenant/middleware_bucket_auth_test.go | 4 ++-- tenant/middleware_bucket_logging.go | 3 +-- tenant/middleware_bucket_metrics.go | 3 +-- tenant/middleware_org_auth.go | 3 +-- tenant/middleware_org_auth_test.go | 4 ++-- tenant/middleware_org_logging.go | 3 +-- tenant/middleware_org_metrics.go | 3 +-- tenant/middleware_urm_auth.go | 3 +-- tenant/middleware_urm_auth_test.go | 5 ++--- tenant/middleware_urm_logging.go | 3 +-- tenant/middleware_urm_metrics.go | 3 +-- tenant/middleware_user_auth.go | 3 +-- tenant/middleware_user_auth_test.go | 4 ++-- tenant/middleware_user_logging.go | 3 +-- tenant/middleware_user_metrics.go | 3 +-- tenant/service_bucket.go | 3 +-- tenant/service_onboarding.go | 5 ++--- tenant/service_onboarding_test.go | 6 ++---- tenant/service_op_log.go | 3 +-- tenant/service_org.go | 3 +-- tenant/service_urm.go | 3 +-- tenant/service_user.go | 3 +-- tenant/storage.go | 1 - tenant/storage_bucket.go | 3 +-- tenant/storage_org.go | 3 +-- tenant/storage_urm.go | 3 +-- tenant/storage_user.go | 3 +-- testing/auth.go | 5 ++--- testing/bucket_service.go | 5 ++--- testing/dbrp_mapping.go | 5 ++--- testing/label_service.go | 5 ++--- testing/migration.go | 1 - testing/onboarding.go | 5 ++--- testing/organization_service.go | 5 ++--- testing/passwords.go | 3 +-- testing/scraper_target.go | 5 ++--- testing/secret.go | 5 ++--- testing/session.go | 5 ++--- testing/source.go | 5 ++--- testing/user_resource_mapping_service.go | 3 +-- testing/user_service.go | 5 ++--- testing/variable.go | 5 ++--- tests/client.go | 3 +-- tests/mock.go | 3 +-- tests/pipeline/fixture.go | 3 +-- tests/pipeline_helpers.go | 3 +-- tsdb/cursors/mock/cursor_iterator.go | 3 ++- tsdb/cursors/mock/integer_array_cursor.go | 3 ++- tsdb/engine/engine.go | 1 + tsdb/engine/tsm1/reader_test.go | 10 ++++----- tsdb/index/tsi1/log_file_test.go | 5 ++--- tsdb/shard_test.go | 3 +-- tsdb/store.go | 3 +-- user_resource_mapping_test.go | 2 +- v1/authorization/authorizer.go | 3 +-- v1/authorization/caching_password_service.go | 3 +-- .../caching_password_service_test.go | 3 +-- v1/authorization/http_client.go | 3 +-- v1/authorization/http_server.go | 5 ++--- v1/authorization/http_server_test.go | 5 ++--- .../middleware_auth_password_service.go | 3 +-- .../middleware_auth_password_service_test.go | 2 +- v1/authorization/mock_tenant.go | 3 +-- v1/authorization/mocks/auth_finder.go | 3 ++- v1/authorization/mocks/auth_token_finder.go | 3 ++- v1/authorization/mocks/password_comparer.go | 3 ++- v1/authorization/mocks/password_service.go | 3 ++- v1/authorization/mocks/user_finder.go | 3 ++- v1/authorization/service.go | 3 +-- v1/authorization/service_password.go | 1 - v1/authorization/storage.go | 1 - v1/authorization/storage_authorization.go | 5 ++--- .../storage_authorization_test.go | 3 +-- v1/authorization/storage_password.go | 1 - v1/coordinator/shard_mapper.go | 3 +-- v1/coordinator/shard_mapper_test.go | 2 +- v1/coordinator/statement_executor.go | 3 +-- v1/coordinator/statement_executor_test.go | 3 +-- v1/services/meta/data_internal_test.go | 3 +-- v1/services/meta/data_test.go | 3 +-- v1/services/storage/store.go | 3 +-- vault/secret.go | 3 +-- zap/auth_service.go | 3 +-- zap/tracer.go | 1 - 399 files changed, 586 insertions(+), 871 deletions(-) diff --git a/authorization/http_client.go b/authorization/http_client.go index 6ce16c3a3d2..d51d8366ef2 100644 --- a/authorization/http_client.go +++ b/authorization/http_client.go @@ -4,9 +4,8 @@ import ( "context" "errors" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/pkg/httpc" ) diff --git a/authorization/http_server.go b/authorization/http_server.go index 1bc01b9c7b5..b27b68f355c 100644 --- a/authorization/http_server.go +++ b/authorization/http_server.go @@ -7,13 +7,12 @@ import ( "net/http" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/influxdata/influxdb/v2" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "go.uber.org/zap" ) diff --git a/authorization/http_server_test.go b/authorization/http_server_test.go index 2c2e261ccaa..4ab04b82a66 100644 --- a/authorization/http_server_test.go +++ b/authorization/http_server_test.go @@ -11,18 +11,17 @@ import ( "sort" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/stretchr/testify/require" - "github.com/go-chi/chi" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" itesting "github.com/influxdata/influxdb/v2/testing" + "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) diff --git a/authorization/middleware_auth.go b/authorization/middleware_auth.go index de0f3e9d2b6..4e82ab5692c 100644 --- a/authorization/middleware_auth.go +++ b/authorization/middleware_auth.go @@ -4,11 +4,10 @@ import ( "context" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" ) type AuthedAuthorizationService struct { diff --git a/authorization/middleware_auth_test.go b/authorization/middleware_auth_test.go index ddfa2d6ed9d..7ed49182a99 100644 --- a/authorization/middleware_auth_test.go +++ b/authorization/middleware_auth_test.go @@ -3,8 +3,6 @@ package authorization_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -13,6 +11,8 @@ import ( "github.com/influxdata/influxdb/v2/authorization" influxdbcontext "github.com/influxdata/influxdb/v2/context" "github.com/influxdata/influxdb/v2/inmem" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kv/migration/all" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/tenant" diff --git a/authorization/middleware_logging.go b/authorization/middleware_logging.go index b93a623d3b2..42a4ac24988 100644 --- a/authorization/middleware_logging.go +++ b/authorization/middleware_logging.go @@ -5,9 +5,8 @@ import ( "fmt" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "go.uber.org/zap" ) diff --git a/authorization/middleware_metrics.go b/authorization/middleware_metrics.go index f4a2618242a..b541f672e0f 100644 --- a/authorization/middleware_metrics.go +++ b/authorization/middleware_metrics.go @@ -3,10 +3,9 @@ package authorization import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/metric" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/prometheus/client_golang/prometheus" ) diff --git a/authorization/mock_tenant.go b/authorization/mock_tenant.go index 0b047f8e6f8..42c084b25ab 100644 --- a/authorization/mock_tenant.go +++ b/authorization/mock_tenant.go @@ -3,9 +3,8 @@ package authorization import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) // tenantService is a mock implementation of an authorization.tenantService diff --git a/authorization/service.go b/authorization/service.go index f65b0adcf5e..196c4a7b9e4 100644 --- a/authorization/service.go +++ b/authorization/service.go @@ -4,10 +4,9 @@ import ( "context" "time" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/rand" ) diff --git a/authorization/storage.go b/authorization/storage.go index 264fa27ab08..4b8c8fdec3b 100644 --- a/authorization/storage.go +++ b/authorization/storage.go @@ -5,7 +5,6 @@ import ( "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/snowflake" diff --git a/authorization/storage_authorization.go b/authorization/storage_authorization.go index c689fe5765b..3a25146655d 100644 --- a/authorization/storage_authorization.go +++ b/authorization/storage_authorization.go @@ -4,11 +4,10 @@ import ( "context" "encoding/json" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/buger/jsonparser" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kv" jsonp "github.com/influxdata/influxdb/v2/pkg/jsonparser" ) diff --git a/authorization/storage_authorization_test.go b/authorization/storage_authorization_test.go index 62ea964f84a..79406a2d249 100644 --- a/authorization/storage_authorization_test.go +++ b/authorization/storage_authorization_test.go @@ -3,13 +3,13 @@ package authorization_test import ( "context" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform" "reflect" "testing" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorization" "github.com/influxdata/influxdb/v2/inmem" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/kv/migration/all" "go.uber.org/zap/zaptest" diff --git a/authorizer/agent.go b/authorizer/agent.go index 1b7d1967956..62cf1b0c94f 100644 --- a/authorizer/agent.go +++ b/authorizer/agent.go @@ -3,10 +3,9 @@ package authorizer import ( "context" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" ) // AuthAgent provides a means to authenticate users with resource and their associate actions. It diff --git a/authorizer/agent_test.go b/authorizer/agent_test.go index aa8254729df..12fd914f73f 100644 --- a/authorizer/agent_test.go +++ b/authorizer/agent_test.go @@ -2,12 +2,12 @@ package authorizer_test import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" "testing" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" "github.com/stretchr/testify/require" diff --git a/authorizer/auth.go b/authorizer/auth.go index c09ca0e03cf..3e70d0fbe5d 100644 --- a/authorizer/auth.go +++ b/authorizer/auth.go @@ -4,10 +4,9 @@ import ( "context" "fmt" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" ) var _ influxdb.AuthorizationService = (*AuthorizationService)(nil) diff --git a/authorizer/auth_test.go b/authorizer/auth_test.go index d18abe4a3de..3f1538db230 100644 --- a/authorizer/auth_test.go +++ b/authorizer/auth_test.go @@ -3,8 +3,6 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/authorizer/authorize.go b/authorizer/authorize.go index 4bc61c71652..537f45f9f6b 100644 --- a/authorizer/authorize.go +++ b/authorizer/authorize.go @@ -4,11 +4,10 @@ import ( "context" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" ) func isAllowedAll(a influxdb.Authorizer, permissions []influxdb.Permission) error { diff --git a/authorizer/bucket.go b/authorizer/bucket.go index a3f91f199c7..81dd4334154 100644 --- a/authorizer/bucket.go +++ b/authorizer/bucket.go @@ -3,9 +3,8 @@ package authorizer import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/tracing" ) diff --git a/authorizer/bucket_test.go b/authorizer/bucket_test.go index 05242efe5bb..81faf2e01e4 100644 --- a/authorizer/bucket_test.go +++ b/authorizer/bucket_test.go @@ -3,8 +3,6 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/authorizer/check_test.go b/authorizer/check_test.go index 0a3ebfc69c5..f90c1a91d80 100644 --- a/authorizer/check_test.go +++ b/authorizer/check_test.go @@ -3,8 +3,6 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/notification/check" influxdbtesting "github.com/influxdata/influxdb/v2/testing" diff --git a/authorizer/dashboard.go b/authorizer/dashboard.go index 25608bcde7c..17ebb46fb63 100644 --- a/authorizer/dashboard.go +++ b/authorizer/dashboard.go @@ -3,9 +3,8 @@ package authorizer import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.DashboardService = (*DashboardService)(nil) diff --git a/authorizer/dashboard_test.go b/authorizer/dashboard_test.go index aef571fac5e..f817b92c9dc 100644 --- a/authorizer/dashboard_test.go +++ b/authorizer/dashboard_test.go @@ -3,8 +3,6 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/authorizer/document.go b/authorizer/document.go index 49c8ad97ee3..4c027de1f4e 100644 --- a/authorizer/document.go +++ b/authorizer/document.go @@ -4,9 +4,8 @@ import ( "context" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.DocumentService = (*DocumentService)(nil) diff --git a/authorizer/label.go b/authorizer/label.go index c4ca5749426..d1fafd2f718 100644 --- a/authorizer/label.go +++ b/authorizer/label.go @@ -3,9 +3,8 @@ package authorizer import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.LabelService = (*LabelService)(nil) diff --git a/authorizer/label_test.go b/authorizer/label_test.go index e99db1592c9..a03173dd889 100644 --- a/authorizer/label_test.go +++ b/authorizer/label_test.go @@ -3,8 +3,6 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/authorizer/notification_endpoint.go b/authorizer/notification_endpoint.go index b8f99dbceb2..c316e7b2ff8 100644 --- a/authorizer/notification_endpoint.go +++ b/authorizer/notification_endpoint.go @@ -3,10 +3,9 @@ package authorizer import ( "context" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" ) var _ influxdb.NotificationEndpointService = (*NotificationEndpointService)(nil) diff --git a/authorizer/notification_endpoint_test.go b/authorizer/notification_endpoint_test.go index 16daf0dd901..04fb3b098c5 100644 --- a/authorizer/notification_endpoint_test.go +++ b/authorizer/notification_endpoint_test.go @@ -3,8 +3,6 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/notification/endpoint" influxdbtesting "github.com/influxdata/influxdb/v2/testing" diff --git a/authorizer/notification_rule.go b/authorizer/notification_rule.go index 4c5276ecfc4..1a586d70d15 100644 --- a/authorizer/notification_rule.go +++ b/authorizer/notification_rule.go @@ -3,9 +3,8 @@ package authorizer import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.NotificationRuleStore = (*NotificationRuleStore)(nil) diff --git a/authorizer/notification_rule_test.go b/authorizer/notification_rule_test.go index 492d6b78eae..adb1b2818b5 100644 --- a/authorizer/notification_rule_test.go +++ b/authorizer/notification_rule_test.go @@ -3,8 +3,6 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/notification/rule" influxdbtesting "github.com/influxdata/influxdb/v2/testing" diff --git a/authorizer/org.go b/authorizer/org.go index 3b3726086a0..e57b9cfbcd3 100644 --- a/authorizer/org.go +++ b/authorizer/org.go @@ -3,10 +3,9 @@ package authorizer import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.OrganizationService = (*OrgService)(nil) diff --git a/authorizer/org_test.go b/authorizer/org_test.go index 6387bf50c2d..e5ea7785f5c 100644 --- a/authorizer/org_test.go +++ b/authorizer/org_test.go @@ -3,8 +3,6 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/authorizer/password.go b/authorizer/password.go index 188695c343c..b0605d65dbd 100644 --- a/authorizer/password.go +++ b/authorizer/password.go @@ -3,9 +3,8 @@ package authorizer import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) // PasswordService is a new authorization middleware for a password service. diff --git a/authorizer/password_test.go b/authorizer/password_test.go index f203cb2cd44..b0b6df6729f 100644 --- a/authorizer/password_test.go +++ b/authorizer/password_test.go @@ -2,12 +2,12 @@ package authorizer_test import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" "testing" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" "github.com/stretchr/testify/require" ) diff --git a/authorizer/restore.go b/authorizer/restore.go index 2add181c75b..51f5e9f5035 100644 --- a/authorizer/restore.go +++ b/authorizer/restore.go @@ -4,9 +4,8 @@ import ( "context" "io" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/tracing" ) diff --git a/authorizer/scraper.go b/authorizer/scraper.go index e1b65518a9c..c2c3c8c17c8 100644 --- a/authorizer/scraper.go +++ b/authorizer/scraper.go @@ -3,9 +3,8 @@ package authorizer import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.ScraperTargetStoreService = (*ScraperTargetStoreService)(nil) diff --git a/authorizer/scraper_test.go b/authorizer/scraper_test.go index 1ef0949b865..18dca984b91 100644 --- a/authorizer/scraper_test.go +++ b/authorizer/scraper_test.go @@ -3,8 +3,6 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/authorizer/secret.go b/authorizer/secret.go index f0fe2bba9dc..bf816f96187 100644 --- a/authorizer/secret.go +++ b/authorizer/secret.go @@ -3,9 +3,8 @@ package authorizer import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.SecretService = (*SecretService)(nil) diff --git a/authorizer/secret_test.go b/authorizer/secret_test.go index 61271170b0d..cca5f09093d 100644 --- a/authorizer/secret_test.go +++ b/authorizer/secret_test.go @@ -3,14 +3,14 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "testing" "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/authorizer/source.go b/authorizer/source.go index 5dc170347ed..90b6ac5879c 100644 --- a/authorizer/source.go +++ b/authorizer/source.go @@ -3,9 +3,8 @@ package authorizer import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.SourceService = (*SourceService)(nil) diff --git a/authorizer/source_test.go b/authorizer/source_test.go index 69be29dd04d..2a41608cf04 100644 --- a/authorizer/source_test.go +++ b/authorizer/source_test.go @@ -3,8 +3,6 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/authorizer/sql_backup_restore_test.go b/authorizer/sql_backup_restore_test.go index 6c896ad2604..b7a5ed2dbc7 100644 --- a/authorizer/sql_backup_restore_test.go +++ b/authorizer/sql_backup_restore_test.go @@ -6,13 +6,12 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/stretchr/testify/require" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" + "github.com/stretchr/testify/require" ) func Test_BackupSqlStore(t *testing.T) { diff --git a/authorizer/telegraf.go b/authorizer/telegraf.go index 256eb7026b4..614c7eabd95 100644 --- a/authorizer/telegraf.go +++ b/authorizer/telegraf.go @@ -3,9 +3,8 @@ package authorizer import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.TelegrafConfigStore = (*TelegrafConfigService)(nil) diff --git a/authorizer/telegraf_test.go b/authorizer/telegraf_test.go index 26c0dbc69ba..85581e19d82 100644 --- a/authorizer/telegraf_test.go +++ b/authorizer/telegraf_test.go @@ -3,8 +3,6 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/authorizer/urm.go b/authorizer/urm.go index 9bea567ec07..b59b0d75ad3 100644 --- a/authorizer/urm.go +++ b/authorizer/urm.go @@ -3,9 +3,8 @@ package authorizer import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) type OrgIDResolver interface { diff --git a/authorizer/urm_test.go b/authorizer/urm_test.go index d095fb2e1a7..8d2152fde3e 100644 --- a/authorizer/urm_test.go +++ b/authorizer/urm_test.go @@ -2,14 +2,14 @@ package authorizer_test import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "testing" "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/authorizer/user.go b/authorizer/user.go index 50a075548a6..68702212551 100644 --- a/authorizer/user.go +++ b/authorizer/user.go @@ -3,10 +3,9 @@ package authorizer import ( "context" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" ) var _ influxdb.UserService = (*UserService)(nil) diff --git a/authorizer/user_test.go b/authorizer/user_test.go index 7438c2cf748..f960adfa916 100644 --- a/authorizer/user_test.go +++ b/authorizer/user_test.go @@ -3,8 +3,6 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/authorizer/variable.go b/authorizer/variable.go index f5a61ffe468..b8d2608b2b0 100644 --- a/authorizer/variable.go +++ b/authorizer/variable.go @@ -3,9 +3,8 @@ package authorizer import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.VariableService = (*VariableService)(nil) diff --git a/authorizer/variable_test.go b/authorizer/variable_test.go index a846f3fd6d4..dbde4ee8497 100644 --- a/authorizer/variable_test.go +++ b/authorizer/variable_test.go @@ -3,8 +3,6 @@ package authorizer_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/bolt/bbolt.go b/bolt/bbolt.go index 7da4039d68c..e6b5d9a3a01 100644 --- a/bolt/bbolt.go +++ b/bolt/bbolt.go @@ -7,9 +7,8 @@ import ( "path/filepath" "time" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/rand" "github.com/influxdata/influxdb/v2/snowflake" bolt "go.etcd.io/bbolt" diff --git a/bolt/id.go b/bolt/id.go index a7bf8f2dd0a..a6ad52f4548 100644 --- a/bolt/id.go +++ b/bolt/id.go @@ -6,7 +6,6 @@ import ( "math/rand" platform2 "github.com/influxdata/influxdb/v2/kit/platform" - bolt "go.etcd.io/bbolt" "go.uber.org/zap" ) diff --git a/bolt/id_test.go b/bolt/id_test.go index 44c5a801c09..017993736b6 100644 --- a/bolt/id_test.go +++ b/bolt/id_test.go @@ -2,9 +2,9 @@ package bolt_test import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" "testing" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" ) diff --git a/cmd/influxd/inspect/build_tsi/build_tsi.go b/cmd/influxd/inspect/build_tsi/build_tsi.go index e989360b6a2..766f2ebd98b 100644 --- a/cmd/influxd/inspect/build_tsi/build_tsi.go +++ b/cmd/influxd/inspect/build_tsi/build_tsi.go @@ -10,8 +10,6 @@ import ( "strconv" "sync/atomic" - "go.uber.org/zap/zapcore" - "github.com/influxdata/influx-cli/v2/clients" "github.com/influxdata/influx-cli/v2/pkg/stdio" "github.com/influxdata/influxdb/v2/logger" @@ -22,6 +20,7 @@ import ( "github.com/influxdata/influxdb/v2/tsdb/index/tsi1" "github.com/spf13/cobra" "go.uber.org/zap" + "go.uber.org/zap/zapcore" "golang.org/x/sync/errgroup" ) diff --git a/cmd/influxd/inspect/export_lp/export_lp.go b/cmd/influxd/inspect/export_lp/export_lp.go index eaab7a55325..3a5549208e6 100644 --- a/cmd/influxd/inspect/export_lp/export_lp.go +++ b/cmd/influxd/inspect/export_lp/export_lp.go @@ -13,9 +13,8 @@ import ( "sync" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/cli" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxdb/v2/pkg/escape" "github.com/influxdata/influxdb/v2/tsdb/engine/tsm1" diff --git a/cmd/influxd/launcher/engine.go b/cmd/influxd/launcher/engine.go index 1ee720547d1..aa371fb5712 100644 --- a/cmd/influxd/launcher/engine.go +++ b/cmd/influxd/launcher/engine.go @@ -8,10 +8,9 @@ import ( "sync" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/http" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/prom" "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxdb/v2/storage" diff --git a/cmd/influxd/launcher/launcher.go b/cmd/influxd/launcher/launcher.go index c6ca4bddbde..bf62e31b843 100644 --- a/cmd/influxd/launcher/launcher.go +++ b/cmd/influxd/launcher/launcher.go @@ -76,8 +76,12 @@ import ( telegrafservice "github.com/influxdata/influxdb/v2/telegraf/service" "github.com/influxdata/influxdb/v2/telemetry" "github.com/influxdata/influxdb/v2/tenant" - _ "github.com/influxdata/influxdb/v2/tsdb/engine/tsm1" // needed for tsm1 - _ "github.com/influxdata/influxdb/v2/tsdb/index/tsi1" // needed for tsi1 + + // needed for tsm1 + _ "github.com/influxdata/influxdb/v2/tsdb/engine/tsm1" + + // needed for tsi1 + _ "github.com/influxdata/influxdb/v2/tsdb/index/tsi1" authv1 "github.com/influxdata/influxdb/v2/v1/authorization" iqlcoordinator "github.com/influxdata/influxdb/v2/v1/coordinator" "github.com/influxdata/influxdb/v2/v1/services/meta" @@ -658,10 +662,11 @@ func (m *Launcher) run(ctx context.Context, opts *InfluxdOpts) (err error) { ts.BucketService = replications.NewBucketService( m.log.With(zap.String("service", "replication_buckets")), ts.BucketService, replicationSvc) + errorHandler := kithttp.NewErrorHandler(m.log.With(zap.String("handler", "error_logger"))) m.apibackend = &http.APIBackend{ AssetsPath: opts.AssetsPath, UIDisabled: opts.UIDisabled, - HTTPErrorHandler: kithttp.ErrorHandler(0), + HTTPErrorHandler: errorHandler, Logger: m.log, FluxLogEnabled: opts.FluxLogEnabled, SessionRenewDisabled: opts.SessionRenewDisabled, @@ -720,7 +725,7 @@ func (m *Launcher) run(ctx context.Context, opts *InfluxdOpts) (err error) { WriteEventRecorder: infprom.NewEventRecorder("write"), QueryEventRecorder: infprom.NewEventRecorder("query"), Flagger: m.flagger, - FlagsHandler: feature.NewFlagsHandler(kithttp.ErrorHandler(0), feature.ByKey), + FlagsHandler: feature.NewFlagsHandler(errorHandler, feature.ByKey), } m.reg.MustRegister(m.apibackend.PrometheusCollectors()...) diff --git a/cmd/influxd/launcher/print_config_test.go b/cmd/influxd/launcher/print_config_test.go index e56771bc330..cc2a7882254 100644 --- a/cmd/influxd/launcher/print_config_test.go +++ b/cmd/influxd/launcher/print_config_test.go @@ -4,9 +4,8 @@ import ( "bytes" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/cli" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/stretchr/testify/require" "go.uber.org/zap/zapcore" ) diff --git a/cmd/influxd/launcher/query_test.go b/cmd/influxd/launcher/query_test.go index 697f3e580ad..7f5291621c9 100644 --- a/cmd/influxd/launcher/query_test.go +++ b/cmd/influxd/launcher/query_test.go @@ -15,8 +15,6 @@ import ( "testing" "time" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/flux" "github.com/influxdata/flux/csv" "github.com/influxdata/flux/execute" @@ -29,6 +27,7 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/cmd/influxd/launcher" phttp "github.com/influxdata/influxdb/v2/http" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kit/prom" "github.com/influxdata/influxdb/v2/query" "go.uber.org/zap" diff --git a/cmd/influxd/upgrade/security.go b/cmd/influxd/upgrade/security.go index d8597e51198..6dfecc30269 100644 --- a/cmd/influxd/upgrade/security.go +++ b/cmd/influxd/upgrade/security.go @@ -9,9 +9,8 @@ import ( "fmt" "sort" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/v1/services/meta" "github.com/influxdata/influxql" "go.uber.org/zap" diff --git a/cmd/influxd/upgrade/security_test.go b/cmd/influxd/upgrade/security_test.go index 41f6611fbdb..e8b895d7f5d 100644 --- a/cmd/influxd/upgrade/security_test.go +++ b/cmd/influxd/upgrade/security_test.go @@ -8,12 +8,11 @@ import ( "testing" "unsafe" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorization" "github.com/influxdata/influxdb/v2/inmem" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv/migration" "github.com/influxdata/influxdb/v2/kv/migration/all" "github.com/influxdata/influxdb/v2/pkg/testing/assert" diff --git a/context/token.go b/context/token.go index e516cc3fcab..42e04cbe120 100644 --- a/context/token.go +++ b/context/token.go @@ -4,10 +4,9 @@ import ( "context" "fmt" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" ) type contextKey string diff --git a/context/token_test.go b/context/token_test.go index 1700d736f5b..bc1eaa3ab37 100644 --- a/context/token_test.go +++ b/context/token_test.go @@ -2,11 +2,11 @@ package context_test import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" "testing" "github.com/influxdata/influxdb/v2" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" ) func TestGetAuthorizer(t *testing.T) { diff --git a/dashboards/service.go b/dashboards/service.go index 4d3fa99e6e1..e65c3e40c33 100644 --- a/dashboards/service.go +++ b/dashboards/service.go @@ -6,12 +6,11 @@ import ( "encoding/json" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - influxdb "github.com/influxdata/influxdb/v2" icontext "github.com/influxdata/influxdb/v2/context" "github.com/influxdata/influxdb/v2/kit/feature" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/snowflake" ) diff --git a/dashboards/testing/dashboards.go b/dashboards/testing/dashboards.go index cb308f575d8..5a4c5aae473 100644 --- a/dashboards/testing/dashboards.go +++ b/dashboards/testing/dashboards.go @@ -6,13 +6,12 @@ import ( "testing" "time" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" platform "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/feature" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" ) diff --git a/dashboards/testing/util.go b/dashboards/testing/util.go index 2de0a5d9ee5..a084a6b7053 100644 --- a/dashboards/testing/util.go +++ b/dashboards/testing/util.go @@ -4,10 +4,9 @@ import ( "context" "testing" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" ) // TODO(goller): remove opPrefix argument diff --git a/dashboards/transport/http.go b/dashboards/transport/http.go index faf4e1d40e4..cd7a546104f 100644 --- a/dashboards/transport/http.go +++ b/dashboards/transport/http.go @@ -7,12 +7,11 @@ import ( "net/http" "path" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/pkg/httpc" "go.uber.org/zap" diff --git a/dbrp/bucket_service.go b/dbrp/bucket_service.go index 6cee68ebb52..847f4edb779 100644 --- a/dbrp/bucket_service.go +++ b/dbrp/bucket_service.go @@ -3,9 +3,8 @@ package dbrp import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "go.uber.org/zap" ) diff --git a/dbrp/http_client_dbrp.go b/dbrp/http_client_dbrp.go index 3b1a8635c5f..d2e996b2423 100644 --- a/dbrp/http_client_dbrp.go +++ b/dbrp/http_client_dbrp.go @@ -6,9 +6,8 @@ import ( "path" "strconv" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/pkg/httpc" ) diff --git a/dbrp/http_client_dbrp_test.go b/dbrp/http_client_dbrp_test.go index 611420cbe39..1b8eddf706a 100644 --- a/dbrp/http_client_dbrp_test.go +++ b/dbrp/http_client_dbrp_test.go @@ -2,13 +2,13 @@ package dbrp_test import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" "net/http/httptest" "testing" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/dbrp" "github.com/influxdata/influxdb/v2/http" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/pkg/httpc" "go.uber.org/zap/zaptest" diff --git a/dbrp/http_server_dbrp.go b/dbrp/http_server_dbrp.go index d7de8d02dd9..617b44ec50c 100644 --- a/dbrp/http_server_dbrp.go +++ b/dbrp/http_server_dbrp.go @@ -5,12 +5,11 @@ import ( "net/http" "strconv" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "go.uber.org/zap" ) diff --git a/dbrp/middleware_auth.go b/dbrp/middleware_auth.go index 41411d3d869..37610a01acf 100644 --- a/dbrp/middleware_auth.go +++ b/dbrp/middleware_auth.go @@ -3,10 +3,9 @@ package dbrp import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.DBRPMappingService = (*AuthorizedService)(nil) diff --git a/dbrp/middleware_auth_test.go b/dbrp/middleware_auth_test.go index 2fe472cf74c..7ba4464bdf3 100644 --- a/dbrp/middleware_auth_test.go +++ b/dbrp/middleware_auth_test.go @@ -2,14 +2,14 @@ package dbrp_test import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "testing" "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" influxdbcontext "github.com/influxdata/influxdb/v2/context" "github.com/influxdata/influxdb/v2/dbrp" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/dbrp/mocks/bucket_service.go b/dbrp/mocks/bucket_service.go index 07a18d13d88..7fe87bf5efc 100644 --- a/dbrp/mocks/bucket_service.go +++ b/dbrp/mocks/bucket_service.go @@ -6,10 +6,11 @@ package mocks import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" influxdb "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" - reflect "reflect" ) // MockBucketService is a mock of BucketService interface diff --git a/dbrp/mocks/dbrp_mapping_service.go b/dbrp/mocks/dbrp_mapping_service.go index 085790844ee..6f529e58e80 100644 --- a/dbrp/mocks/dbrp_mapping_service.go +++ b/dbrp/mocks/dbrp_mapping_service.go @@ -6,10 +6,11 @@ package mocks import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" influxdb "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" - reflect "reflect" ) // MockDBRPMappingService is a mock of DBRPMappingService interface diff --git a/dbrp/service.go b/dbrp/service.go index 42cc5185eb7..70ca7d5ae64 100644 --- a/dbrp/service.go +++ b/dbrp/service.go @@ -29,9 +29,8 @@ import ( "context" "encoding/json" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/snowflake" ) diff --git a/fluxinit/init.go b/fluxinit/init.go index 281edde5c9d..ff11815dfbf 100644 --- a/fluxinit/init.go +++ b/fluxinit/init.go @@ -8,9 +8,10 @@ package fluxinit import ( "github.com/influxdata/flux/runtime" - _ "github.com/influxdata/flux/stdlib" - _ "github.com/influxdata/influxdb/v2/query/stdlib" // Import the stdlib + + // Import the stdlib + _ "github.com/influxdata/influxdb/v2/query/stdlib" ) // The FluxInit() function prepares the runtime for compilation and execution diff --git a/gather/metrics.go b/gather/metrics.go index 4735117aba2..87c12d97f01 100644 --- a/gather/metrics.go +++ b/gather/metrics.go @@ -5,9 +5,8 @@ import ( "io" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/gogo/protobuf/proto" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/models" ) diff --git a/gather/scraper_test.go b/gather/scraper_test.go index 13ae273b64a..0eaad61042d 100644 --- a/gather/scraper_test.go +++ b/gather/scraper_test.go @@ -9,10 +9,9 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var ( diff --git a/http/api_handler_test.go b/http/api_handler_test.go index 124c3a20e71..546a32eb0b4 100644 --- a/http/api_handler_test.go +++ b/http/api_handler_test.go @@ -112,7 +112,7 @@ func TestAPIHandler_NotFound(t *testing.T) { w := httptest.NewRecorder() b := &APIBackend{ - HTTPErrorHandler: kithttp.ErrorHandler(0), + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), Logger: zaptest.NewLogger(t), } diff --git a/http/auth_service.go b/http/auth_service.go index f0ea40a40bf..a7ef7109991 100644 --- a/http/auth_service.go +++ b/http/auth_service.go @@ -8,12 +8,11 @@ import ( "net/http" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" platcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/pkg/httpc" "go.uber.org/zap" ) diff --git a/http/auth_test.go b/http/auth_test.go index ee79468279e..ce725be2a6f 100644 --- a/http/auth_test.go +++ b/http/auth_test.go @@ -10,13 +10,12 @@ import ( "net/http/httptest" "testing" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" platform "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorization" pcontext "github.com/influxdata/influxdb/v2/context" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/mock" @@ -336,7 +335,7 @@ func TestService_handleGetAuthorizations(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { authorizationBackend := NewMockAuthorizationBackend(t) - authorizationBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + authorizationBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) authorizationBackend.AuthorizationService = tt.fields.AuthorizationService authorizationBackend.UserService = tt.fields.UserService authorizationBackend.OrganizationService = tt.fields.OrganizationService @@ -521,7 +520,7 @@ func TestService_handleGetAuthorization(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { authorizationBackend := NewMockAuthorizationBackend(t) - authorizationBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + authorizationBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) authorizationBackend.AuthorizationService = tt.fields.AuthorizationService authorizationBackend.UserService = tt.fields.UserService authorizationBackend.OrganizationService = tt.fields.OrganizationService @@ -701,7 +700,7 @@ func TestService_handlePostAuthorization(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { authorizationBackend := NewMockAuthorizationBackend(t) - authorizationBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + authorizationBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) authorizationBackend.AuthorizationService = tt.fields.AuthorizationService authorizationBackend.UserService = tt.fields.UserService authorizationBackend.OrganizationService = tt.fields.OrganizationService @@ -815,7 +814,7 @@ func TestService_handleDeleteAuthorization(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { authorizationBackend := NewMockAuthorizationBackend(t) - authorizationBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + authorizationBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) authorizationBackend.AuthorizationService = tt.fields.AuthorizationService authorizationBackend.UserService = tt.fields.UserService authorizationBackend.OrganizationService = tt.fields.OrganizationService @@ -920,7 +919,7 @@ func initAuthorizationService(f platformtesting.AuthorizationFields, t *testing. } authorizationBackend := NewMockAuthorizationBackend(t) - authorizationBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + authorizationBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) authorizationBackend.AuthorizationService = authService authorizationBackend.UserService = mus authorizationBackend.OrganizationService = tenantService @@ -937,7 +936,7 @@ func initAuthorizationService(f platformtesting.AuthorizationFields, t *testing. } authZ := NewAuthorizationHandler(zaptest.NewLogger(t), authorizationBackend) - authN := NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.ErrorHandler(0)) + authN := NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.NewErrorHandler(zaptest.NewLogger(t))) authN.AuthorizationService = authService authN.Handler = authZ authN.UserService = mus diff --git a/http/authentication_middleware.go b/http/authentication_middleware.go index 6bdb3aacf78..f53f2d30062 100644 --- a/http/authentication_middleware.go +++ b/http/authentication_middleware.go @@ -7,12 +7,11 @@ import ( "net/http" "time" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" platform "github.com/influxdata/influxdb/v2" platcontext "github.com/influxdata/influxdb/v2/context" "github.com/influxdata/influxdb/v2/jsonweb" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/opentracing/opentracing-go" "go.uber.org/zap" ) diff --git a/http/authentication_test.go b/http/authentication_test.go index c6c83f6a08a..84247f027c6 100644 --- a/http/authentication_test.go +++ b/http/authentication_test.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform" "net/http" "net/http/httptest" "testing" @@ -13,6 +12,7 @@ import ( "github.com/influxdata/influxdb/v2" platformhttp "github.com/influxdata/influxdb/v2/http" "github.com/influxdata/influxdb/v2/jsonweb" + "github.com/influxdata/influxdb/v2/kit/platform" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/mock" "go.uber.org/zap/zaptest" @@ -210,7 +210,7 @@ func TestAuthenticationHandler(t *testing.T) { w.WriteHeader(http.StatusOK) }) - h := platformhttp.NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.ErrorHandler(0)) + h := platformhttp.NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.NewErrorHandler(zaptest.NewLogger(t))) h.AuthorizationService = tt.fields.AuthorizationService h.SessionService = tt.fields.SessionService h.UserService = &mock.UserService{ @@ -377,7 +377,7 @@ func TestAuthenticationHandler_NoAuthRoutes(t *testing.T) { w.WriteHeader(http.StatusOK) }) - h := platformhttp.NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.ErrorHandler(0)) + h := platformhttp.NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.NewErrorHandler(zaptest.NewLogger(t))) h.AuthorizationService = mock.NewAuthorizationService() h.SessionService = mock.NewSessionService() h.Handler = handler diff --git a/http/backup_service.go b/http/backup_service.go index dadbf2d902e..152dfd79bfb 100644 --- a/http/backup_service.go +++ b/http/backup_service.go @@ -9,11 +9,10 @@ import ( "time" "github.com/NYTimes/gziphandler" - "github.com/influxdata/influxdb/v2/authorizer" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/authorizer" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kit/tracing" "go.uber.org/zap" ) diff --git a/http/backup_service_test.go b/http/backup_service_test.go index b292271740c..0da7e105d29 100644 --- a/http/backup_service_test.go +++ b/http/backup_service_test.go @@ -15,6 +15,7 @@ import ( kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/mock" "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" ) func TestBackupMetaService(t *testing.T) { @@ -117,7 +118,7 @@ func TestRequireOperPermissions(t *testing.T) { r = r.WithContext(ctx) h := BackupHandler{ - HTTPErrorHandler: kithttp.ErrorHandler(0), + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), } h.requireOperPermissions(next).ServeHTTP(rr, r) rs := rr.Result() diff --git a/http/check_test.go b/http/check_test.go index a63f0d8df08..5a118b3331d 100644 --- a/http/check_test.go +++ b/http/check_test.go @@ -425,7 +425,7 @@ func TestService_handleGetCheckQuery(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { checkBackend := NewMockCheckBackend(t) - checkBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + checkBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) checkBackend.CheckService = tt.fields.CheckService checkBackend.TaskService = &mock.TaskService{ FindTaskByIDFn: func(ctx context.Context, id platform.ID) (*taskmodel.Task, error) { @@ -567,7 +567,7 @@ func TestService_handleGetCheck(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { checkBackend := NewMockCheckBackend(t) - checkBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + checkBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) checkBackend.CheckService = tt.fields.CheckService checkBackend.TaskService = &mock.TaskService{ FindTaskByIDFn: func(ctx context.Context, id platform.ID) (*taskmodel.Task, error) { @@ -838,7 +838,7 @@ func TestService_handleDeleteCheck(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { checkBackend := NewMockCheckBackend(t) - checkBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + checkBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) checkBackend.CheckService = tt.fields.CheckService checkBackend.TaskService = &mock.TaskService{ FindTaskByIDFn: func(ctx context.Context, id platform.ID) (*taskmodel.Task, error) { @@ -1005,7 +1005,7 @@ func TestService_handlePatchCheck(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { checkBackend := NewMockCheckBackend(t) - checkBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + checkBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) checkBackend.CheckService = tt.fields.CheckService checkBackend.TaskService = &mock.TaskService{ FindTaskByIDFn: func(ctx context.Context, id platform.ID) (*taskmodel.Task, error) { @@ -1200,7 +1200,7 @@ func TestService_handleUpdateCheck(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { checkBackend := NewMockCheckBackend(t) - checkBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + checkBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) checkBackend.CheckService = tt.fields.CheckService checkBackend.TaskService = &mock.TaskService{ FindTaskByIDFn: func(ctx context.Context, id platform.ID) (*taskmodel.Task, error) { diff --git a/http/delete_handler.go b/http/delete_handler.go index bcf1569ff51..1f0d1ad36a4 100644 --- a/http/delete_handler.go +++ b/http/delete_handler.go @@ -8,13 +8,12 @@ import ( http "net/http" "time" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2/models" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" pcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kit/tracing" + "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxdb/v2/predicate" "go.uber.org/zap" ) diff --git a/http/delete_test.go b/http/delete_test.go index b12f85547a8..c75d5a587f4 100644 --- a/http/delete_test.go +++ b/http/delete_test.go @@ -10,14 +10,13 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2/models" - "github.com/influxdata/influxdb/v2" pcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/mock" + "github.com/influxdata/influxdb/v2/models" influxtesting "github.com/influxdata/influxdb/v2/testing" "go.uber.org/zap/zaptest" ) @@ -381,7 +380,7 @@ func TestDelete(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { deleteBackend := NewMockDeleteBackend(t) - deleteBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + deleteBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) deleteBackend.DeleteService = tt.fields.DeleteService deleteBackend.OrganizationService = tt.fields.OrganizationService deleteBackend.BucketService = tt.fields.BucketService diff --git a/http/document_service.go b/http/document_service.go index a454239681e..f09a2a1cc65 100644 --- a/http/document_service.go +++ b/http/document_service.go @@ -6,11 +6,10 @@ import ( "net/http" "path" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/pkg/httpc" "go.uber.org/zap" diff --git a/http/document_service_test.go b/http/document_service_test.go index 6ee3bd9756d..839646eb270 100644 --- a/http/document_service_test.go +++ b/http/document_service_test.go @@ -70,7 +70,7 @@ func setup(t *testing.T) (func(auth influxdb.Authorizer) *httptest.Server, func( } backend := NewMockDocumentBackend(t) - backend.HTTPErrorHandler = http.ErrorHandler(0) + backend.HTTPErrorHandler = http.NewErrorHandler(zaptest.NewLogger(t)) backend.DocumentService = authorizer.NewDocumentService(svc) serverFn := func(auth influxdb.Authorizer) *httptest.Server { handler := httpmock.NewAuthMiddlewareHandler(NewDocumentHandler(backend), auth) diff --git a/http/document_test.go b/http/document_test.go index 44ca9e61be9..d70ba35ed85 100644 --- a/http/document_test.go +++ b/http/document_test.go @@ -7,11 +7,10 @@ import ( "net/http/httptest" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" pcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/mock" influxtesting "github.com/influxdata/influxdb/v2/testing" @@ -131,7 +130,7 @@ func TestService_handleGetDocuments(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { documentBackend := NewMockDocumentBackend(t) - documentBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + documentBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) documentBackend.DocumentService = tt.fields.DocumentService h := NewDocumentHandler(documentBackend) diff --git a/http/errors.go b/http/errors.go index 5b9a7f93a26..9824f116b2a 100644 --- a/http/errors.go +++ b/http/errors.go @@ -12,7 +12,6 @@ import ( "strings" "github.com/influxdata/influxdb/v2/kit/platform/errors" - khttp "github.com/influxdata/influxdb/v2/kit/transport/http" ) diff --git a/http/errors_test.go b/http/errors_test.go index 85dc24f3ba6..69825b1a15c 100644 --- a/http/errors_test.go +++ b/http/errors_test.go @@ -4,14 +4,15 @@ import ( "context" "encoding/json" stderrors "errors" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "io" "net/http/httptest" "testing" "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2/http" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" + "go.uber.org/zap/zaptest" ) func TestCheckError(t *testing.T) { @@ -23,7 +24,7 @@ func TestCheckError(t *testing.T) { { name: "platform error", write: func(w *httptest.ResponseRecorder) { - h := kithttp.ErrorHandler(0) + h := kithttp.NewErrorHandler(zaptest.NewLogger(t)) err := &errors.Error{ Msg: "expected", Code: errors.EInvalid, diff --git a/http/handler.go b/http/handler.go index 7e34fbea718..d20a49b5acd 100644 --- a/http/handler.go +++ b/http/handler.go @@ -5,9 +5,8 @@ import ( "encoding/json" "net/http" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kit/prom" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/pprof" diff --git a/http/influxdb/source_proxy_query_service.go b/http/influxdb/source_proxy_query_service.go index 5effa701e4a..c63f8e5d28b 100644 --- a/http/influxdb/source_proxy_query_service.go +++ b/http/influxdb/source_proxy_query_service.go @@ -8,14 +8,13 @@ import ( "io" "net/http" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/flux" "github.com/influxdata/flux/csv" "github.com/influxdata/flux/lang" platform "github.com/influxdata/influxdb/v2" platformhttp "github.com/influxdata/influxdb/v2/http" "github.com/influxdata/influxdb/v2/kit/check" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/query" "github.com/influxdata/influxdb/v2/query/influxql" diff --git a/http/label_service.go b/http/label_service.go index da54454e1e8..08e3d3aac86 100644 --- a/http/label_service.go +++ b/http/label_service.go @@ -8,11 +8,10 @@ import ( "net/url" "path" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/pkg/httpc" "go.uber.org/zap" ) diff --git a/http/label_test.go b/http/label_test.go index 318feca535f..5fa5ba4cc98 100644 --- a/http/label_test.go +++ b/http/label_test.go @@ -10,11 +10,10 @@ import ( "net/http/httptest" "testing" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/label" "github.com/influxdata/influxdb/v2/mock" @@ -114,7 +113,7 @@ func TestService_handleGetLabels(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.ErrorHandler(0)) + h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.NewErrorHandler(zaptest.NewLogger(t))) r := httptest.NewRequest("GET", "http://any.url", nil) @@ -222,7 +221,7 @@ func TestService_handleGetLabel(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.ErrorHandler(0)) + h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.NewErrorHandler(zaptest.NewLogger(t))) r := httptest.NewRequest("GET", "http://any.url", nil) @@ -317,7 +316,7 @@ func TestService_handlePostLabel(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.ErrorHandler(0)) + h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.NewErrorHandler(zaptest.NewLogger(t))) l, err := json.Marshal(tt.args.label) if err != nil { @@ -408,7 +407,7 @@ func TestService_handleDeleteLabel(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.ErrorHandler(0)) + h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.NewErrorHandler(zaptest.NewLogger(t))) r := httptest.NewRequest("GET", "http://any.url", nil) @@ -547,7 +546,7 @@ func TestService_handlePatchLabel(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.ErrorHandler(0)) + h := NewLabelHandler(zaptest.NewLogger(t), tt.fields.LabelService, kithttp.NewErrorHandler(zaptest.NewLogger(t))) upd := platform.LabelUpdate{} if len(tt.args.properties) > 0 { @@ -624,7 +623,7 @@ func initLabelService(f platformtesting.LabelFields, t *testing.T) (platform.Lab } } - handler := NewLabelHandler(zaptest.NewLogger(t), labelService, kithttp.ErrorHandler(0)) + handler := NewLabelHandler(zaptest.NewLogger(t), labelService, kithttp.NewErrorHandler(zaptest.NewLogger(t))) server := httptest.NewServer(handler) client := LabelService{ Client: mustNewHTTPClient(t, server.URL, ""), diff --git a/http/legacy/backend.go b/http/legacy/backend.go index f8d6ef2c076..448853228e1 100644 --- a/http/legacy/backend.go +++ b/http/legacy/backend.go @@ -3,12 +3,11 @@ package legacy import ( http2 "net/http" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/http/metric" "github.com/influxdata/influxdb/v2/influxql" "github.com/influxdata/influxdb/v2/kit/cli" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/query" "github.com/influxdata/influxdb/v2/storage" "github.com/prometheus/client_golang/prometheus" diff --git a/http/legacy/common.go b/http/legacy/common.go index 177fd55fd03..a0d7f6d8c70 100644 --- a/http/legacy/common.go +++ b/http/legacy/common.go @@ -3,10 +3,9 @@ package legacy import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" pcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform/errors" ) // getAuthorization extracts authorization information from a context.Context. diff --git a/http/legacy/influx1x_authentication_handler.go b/http/legacy/influx1x_authentication_handler.go index b8792d92b52..ff4a3f2be08 100644 --- a/http/legacy/influx1x_authentication_handler.go +++ b/http/legacy/influx1x_authentication_handler.go @@ -7,10 +7,9 @@ import ( "net/http" "strings" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" platcontext "github.com/influxdata/influxdb/v2/context" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/opentracing/opentracing-go" ) diff --git a/http/legacy/influx1x_authentication_handler_test.go b/http/legacy/influx1x_authentication_handler_test.go index 0202bcf31d3..c9f373fc88b 100644 --- a/http/legacy/influx1x_authentication_handler_test.go +++ b/http/legacy/influx1x_authentication_handler_test.go @@ -7,13 +7,13 @@ import ( "net/http/httptest" "testing" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/golang/mock/gomock" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/mock" itesting "github.com/influxdata/influxdb/v2/testing" + "go.uber.org/zap/zaptest" ) const tokenScheme = "Token " // TODO(goller): I'd like this to be Bearer @@ -175,7 +175,7 @@ func TestInflux1xAuthenticationHandler(t *testing.T) { w.WriteHeader(http.StatusOK) }) - h = NewInflux1xAuthenticationHandler(next, auth, kithttp.ErrorHandler(0)) + h = NewInflux1xAuthenticationHandler(next, auth, kithttp.NewErrorHandler(zaptest.NewLogger(t))) } w := httptest.NewRecorder() diff --git a/http/legacy/influxql_handler.go b/http/legacy/influxql_handler.go index c172a3c1269..fffd148692a 100644 --- a/http/legacy/influxql_handler.go +++ b/http/legacy/influxql_handler.go @@ -3,11 +3,10 @@ package legacy import ( "net/http" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - platform "github.com/influxdata/influxdb/v2" influxqld "github.com/influxdata/influxdb/v2/influxql" "github.com/influxdata/influxdb/v2/influxql/control" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/query" "go.uber.org/zap" ) diff --git a/http/legacy/influxqld_handler.go b/http/legacy/influxqld_handler.go index a3614cc8973..e14f7d6f82c 100644 --- a/http/legacy/influxqld_handler.go +++ b/http/legacy/influxqld_handler.go @@ -8,11 +8,10 @@ import ( "strconv" "strings" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/flux/iocounter" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/influxql" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/prometheus/client_golang/prometheus" "go.uber.org/zap" diff --git a/http/legacy/influxqld_handler_test.go b/http/legacy/influxqld_handler_test.go index 5bd07f2cbe1..fe3f1da9d20 100644 --- a/http/legacy/influxqld_handler_test.go +++ b/http/legacy/influxqld_handler_test.go @@ -8,13 +8,12 @@ import ( "net/http/httptest" "testing" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" platform "github.com/influxdata/influxdb/v2" pcontext "github.com/influxdata/influxdb/v2/context" "github.com/influxdata/influxdb/v2/influxql" imock "github.com/influxdata/influxdb/v2/influxql/mock" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/mock" "go.uber.org/zap/zaptest" @@ -228,7 +227,7 @@ func TestInfluxQLdHandler_HandleQuery(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { b := &InfluxQLBackend{ - HTTPErrorHandler: kithttp.ErrorHandler(0), + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), OrganizationService: tt.fields.OrganizationService, InfluxqldQueryService: tt.fields.ProxyQueryService, } diff --git a/http/legacy/router.go b/http/legacy/router.go index ad5045b376c..34f2fb1fb6c 100644 --- a/http/legacy/router.go +++ b/http/legacy/router.go @@ -7,9 +7,8 @@ import ( "runtime/debug" "sync" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" + "github.com/influxdata/influxdb/v2/kit/platform/errors" influxlogger "github.com/influxdata/influxdb/v2/logger" "go.uber.org/zap" "go.uber.org/zap/zapcore" diff --git a/http/legacy/write_handler.go b/http/legacy/write_handler.go index ed81d7eff0c..f8fd0c66a45 100644 --- a/http/legacy/write_handler.go +++ b/http/legacy/write_handler.go @@ -6,13 +6,12 @@ import ( "io" "net/http" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/http/metric" "github.com/influxdata/influxdb/v2/http/points" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kit/tracing" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/storage" diff --git a/http/legacy/write_handler_test.go b/http/legacy/write_handler_test.go index ebe071ceec1..f985b732270 100644 --- a/http/legacy/write_handler_test.go +++ b/http/legacy/write_handler_test.go @@ -11,13 +11,12 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/golang/mock/gomock" "github.com/influxdata/influxdb/v2" pcontext "github.com/influxdata/influxdb/v2/context" "github.com/influxdata/influxdb/v2/dbrp" "github.com/influxdata/influxdb/v2/http/mocks" + "github.com/influxdata/influxdb/v2/kit/platform" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxdb/v2/snowflake" @@ -96,7 +95,7 @@ func TestWriteHandler_BucketAndMappingExistsDefaultRP(t *testing.T) { r.URL.RawQuery = params.Encode() handler := NewWriterHandler(&PointsWriterBackend{ - HTTPErrorHandler: DefaultErrorHandler, + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), Logger: zaptest.NewLogger(t), BucketService: bucketService, DBRPMappingService: dbrp.NewAuthorizedService(dbrpMappingSvc), @@ -177,7 +176,7 @@ func TestWriteHandler_BucketAndMappingExistsSpecificRP(t *testing.T) { r.URL.RawQuery = params.Encode() handler := NewWriterHandler(&PointsWriterBackend{ - HTTPErrorHandler: DefaultErrorHandler, + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), Logger: zaptest.NewLogger(t), BucketService: bucketService, DBRPMappingService: dbrp.NewAuthorizedService(dbrpMappingSvc), @@ -259,7 +258,7 @@ func TestWriteHandler_PartialWrite(t *testing.T) { r.URL.RawQuery = params.Encode() handler := NewWriterHandler(&PointsWriterBackend{ - HTTPErrorHandler: DefaultErrorHandler, + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), Logger: zaptest.NewLogger(t), BucketService: bucketService, DBRPMappingService: dbrp.NewAuthorizedService(dbrpMappingSvc), @@ -334,7 +333,7 @@ func TestWriteHandler_BucketAndMappingExistsNoPermissions(t *testing.T) { r.URL.RawQuery = params.Encode() handler := NewWriterHandler(&PointsWriterBackend{ - HTTPErrorHandler: DefaultErrorHandler, + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), Logger: zaptest.NewLogger(t), BucketService: bucketService, DBRPMappingService: dbrp.NewAuthorizedService(dbrpMappingSvc), @@ -404,7 +403,7 @@ func TestWriteHandler_MappingNotExists(t *testing.T) { r.URL.RawQuery = params.Encode() handler := NewWriterHandler(&PointsWriterBackend{ - HTTPErrorHandler: DefaultErrorHandler, + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), Logger: zaptest.NewLogger(t), BucketService: bucketService, DBRPMappingService: dbrp.NewAuthorizedService(dbrpMappingSvc), @@ -417,8 +416,6 @@ func TestWriteHandler_MappingNotExists(t *testing.T) { assert.Equal(t, `{"code":"not found","message":"unable to find DBRP"}`, w.Body.String()) } -var DefaultErrorHandler = kithttp.ErrorHandler(0) - func parseLineProtocol(t *testing.T, line string) []models.Point { t.Helper() points, err := models.ParsePoints([]byte(line)) diff --git a/http/legacy/write_usage_recorder.go b/http/legacy/write_usage_recorder.go index cd296a3ced4..5b37f6cff14 100644 --- a/http/legacy/write_usage_recorder.go +++ b/http/legacy/write_usage_recorder.go @@ -3,9 +3,8 @@ package legacy import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/http/metric" + "github.com/influxdata/influxdb/v2/kit/platform" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" ) diff --git a/http/mocks/bucket_service.go b/http/mocks/bucket_service.go index e8c59a54e42..7fe87bf5efc 100644 --- a/http/mocks/bucket_service.go +++ b/http/mocks/bucket_service.go @@ -6,11 +6,11 @@ package mocks import ( context "context" - "github.com/influxdata/influxdb/v2/kit/platform" reflect "reflect" gomock "github.com/golang/mock/gomock" influxdb "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) // MockBucketService is a mock of BucketService interface diff --git a/http/mocks/dbrp_mapping_service.go b/http/mocks/dbrp_mapping_service.go index cacadceb607..6f529e58e80 100644 --- a/http/mocks/dbrp_mapping_service.go +++ b/http/mocks/dbrp_mapping_service.go @@ -6,11 +6,11 @@ package mocks import ( context "context" - "github.com/influxdata/influxdb/v2/kit/platform" reflect "reflect" gomock "github.com/golang/mock/gomock" influxdb "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) // MockDBRPMappingService is a mock of DBRPMappingService interface diff --git a/http/mocks/organization_service.go b/http/mocks/organization_service.go index 2d53fca0320..f2028604f14 100644 --- a/http/mocks/organization_service.go +++ b/http/mocks/organization_service.go @@ -6,11 +6,11 @@ package mocks import ( context "context" - "github.com/influxdata/influxdb/v2/kit/platform" reflect "reflect" gomock "github.com/golang/mock/gomock" influxdb "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) // MockOrganizationService is a mock of OrganizationService interface diff --git a/http/mocks/points_writer.go b/http/mocks/points_writer.go index 5132fb6ba7f..0d16494f07b 100644 --- a/http/mocks/points_writer.go +++ b/http/mocks/points_writer.go @@ -6,10 +6,10 @@ package mocks import ( context "context" - "github.com/influxdata/influxdb/v2/kit/platform" reflect "reflect" gomock "github.com/golang/mock/gomock" + "github.com/influxdata/influxdb/v2/kit/platform" models "github.com/influxdata/influxdb/v2/models" ) diff --git a/http/notification_endpoint.go b/http/notification_endpoint.go index cc6c70b0317..b5473cbbde6 100644 --- a/http/notification_endpoint.go +++ b/http/notification_endpoint.go @@ -8,12 +8,11 @@ import ( "io/ioutil" "net/http" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" pctx "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/notification/endpoint" "github.com/influxdata/influxdb/v2/pkg/httpc" "go.uber.org/zap" diff --git a/http/notification_endpoint_test.go b/http/notification_endpoint_test.go index 7bacb857e16..5475c565d84 100644 --- a/http/notification_endpoint_test.go +++ b/http/notification_endpoint_test.go @@ -11,12 +11,11 @@ import ( "path" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" pcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/mock" @@ -35,7 +34,7 @@ import ( func NewMockNotificationEndpointBackend(t *testing.T) *NotificationEndpointBackend { return &NotificationEndpointBackend{ log: zaptest.NewLogger(t), - HTTPErrorHandler: kithttp.ErrorHandler(0), + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), NotificationEndpointService: &mock.NotificationEndpointService{}, UserResourceMappingService: mock.NewUserResourceMappingService(), LabelService: mock.NewLabelService(), @@ -363,7 +362,7 @@ func TestService_handleGetNotificationEndpoint(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { notificationEndpointBackend := NewMockNotificationEndpointBackend(t) - notificationEndpointBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + notificationEndpointBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) notificationEndpointBackend.NotificationEndpointService = tt.fields.NotificationEndpointService h := NewNotificationEndpointHandler(zaptest.NewLogger(t), notificationEndpointBackend) @@ -581,7 +580,7 @@ func TestService_handleDeleteNotificationEndpoint(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { notificationEndpointBackend := NewMockNotificationEndpointBackend(t) - notificationEndpointBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + notificationEndpointBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) notificationEndpointBackend.NotificationEndpointService = tt.fields.NotificationEndpointService testttp. @@ -702,7 +701,7 @@ func TestService_handlePatchNotificationEndpoint(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { notificationEndpointBackend := NewMockNotificationEndpointBackend(t) - notificationEndpointBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + notificationEndpointBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) notificationEndpointBackend.NotificationEndpointService = tt.fields.NotificationEndpointService h := NewNotificationEndpointHandler(zaptest.NewLogger(t), notificationEndpointBackend) @@ -853,7 +852,7 @@ func TestService_handleUpdateNotificationEndpoint(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { notificationEndpointBackend := NewMockNotificationEndpointBackend(t) - notificationEndpointBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + notificationEndpointBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) notificationEndpointBackend.NotificationEndpointService = tt.fields.NotificationEndpointService resp := testttp. diff --git a/http/points/points_parser.go b/http/points/points_parser.go index 3c8752b9c30..95e51688c31 100644 --- a/http/points/points_parser.go +++ b/http/points/points_parser.go @@ -9,10 +9,9 @@ import ( "io/ioutil" "time" + io2 "github.com/influxdata/influxdb/v2/kit/io" "github.com/influxdata/influxdb/v2/kit/platform" errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - - io2 "github.com/influxdata/influxdb/v2/kit/io" "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/models" "github.com/opentracing/opentracing-go" diff --git a/http/query_handler_test.go b/http/query_handler_test.go index 23f278ef61d..d5fa0a7c72a 100644 --- a/http/query_handler_test.go +++ b/http/query_handler_test.go @@ -106,7 +106,7 @@ func TestFluxService_Query(t *testing.T) { if reqID := r.URL.Query().Get(OrgID); reqID == "" { if name := r.URL.Query().Get(Org); name == "" { // Request must have org or orgID. - kithttp.ErrorHandler(0).HandleHTTPError(context.TODO(), influxdb.ErrInvalidOrgFilter, w) + kithttp.NewErrorHandler(zaptest.NewLogger(t)).HandleHTTPError(context.TODO(), influxdb.ErrInvalidOrgFilter, w) return } } @@ -264,7 +264,7 @@ func TestFluxHandler_postFluxAST(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { h := &FluxHandler{ - HTTPErrorHandler: kithttp.ErrorHandler(0), + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), FluxLanguageService: fluxlang.DefaultService, } h.postFluxAST(tt.w, tt.r) @@ -333,7 +333,7 @@ func TestFluxHandler_PostQuery_Errors(t *testing.T) { store := itesting.NewTestInmemStore(t) orgSVC := tenant.NewService(tenant.NewStore(store)) b := &FluxBackend{ - HTTPErrorHandler: kithttp.ErrorHandler(0), + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), log: zaptest.NewLogger(t), QueryEventRecorder: noopEventRecorder{}, OrganizationService: orgSVC, @@ -501,7 +501,7 @@ func TestFluxService_Query_gzip(t *testing.T) { } fluxBackend := &FluxBackend{ - HTTPErrorHandler: kithttp.ErrorHandler(0), + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), log: zaptest.NewLogger(t), QueryEventRecorder: noopEventRecorder{}, OrganizationService: orgService, @@ -515,7 +515,7 @@ func TestFluxService_Query_gzip(t *testing.T) { // fluxHandling expects authorization to be on the request context. // AuthenticationHandler extracts the token from headers and places // the auth on context. - auth := NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.ErrorHandler(0)) + auth := NewAuthenticationHandler(zaptest.NewLogger(t), kithttp.NewErrorHandler(zaptest.NewLogger(t))) auth.AuthorizationService = authService auth.Handler = fluxHandler auth.UserService = &influxmock.UserService{ @@ -639,7 +639,7 @@ func benchmarkQuery(b *testing.B, disableCompression bool) { } fluxBackend := &FluxBackend{ - HTTPErrorHandler: kithttp.ErrorHandler(0), + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(b)), log: zaptest.NewLogger(b), QueryEventRecorder: noopEventRecorder{}, OrganizationService: orgService, @@ -653,7 +653,7 @@ func benchmarkQuery(b *testing.B, disableCompression bool) { // fluxHandling expects authorization to be on the request context. // AuthenticationHandler extracts the token from headers and places // the auth on context. - auth := NewAuthenticationHandler(zaptest.NewLogger(b), kithttp.ErrorHandler(0)) + auth := NewAuthenticationHandler(zaptest.NewLogger(b), kithttp.NewErrorHandler(zaptest.NewLogger(b))) auth.AuthorizationService = authService auth.Handler = fluxHandler diff --git a/http/query_test.go b/http/query_test.go index 707025c8329..5a44954e73c 100644 --- a/http/query_test.go +++ b/http/query_test.go @@ -11,8 +11,6 @@ import ( "testing" "time" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/influxdata/flux" @@ -21,6 +19,7 @@ import ( "github.com/influxdata/flux/lang" platform "github.com/influxdata/influxdb/v2" _ "github.com/influxdata/influxdb/v2/fluxinit/static" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/query" ) diff --git a/http/requests.go b/http/requests.go index 5cb2b43ed76..b1d3e374d88 100644 --- a/http/requests.go +++ b/http/requests.go @@ -4,10 +4,9 @@ import ( "context" "net/http" + platform "github.com/influxdata/influxdb/v2" platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - platform "github.com/influxdata/influxdb/v2" ) const ( diff --git a/http/requests_test.go b/http/requests_test.go index efb59b53bc5..98177e0205e 100644 --- a/http/requests_test.go +++ b/http/requests_test.go @@ -7,10 +7,9 @@ import ( "reflect" "testing" + platform "github.com/influxdata/influxdb/v2" platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - platform "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/mock" ) diff --git a/http/restore_service.go b/http/restore_service.go index 06cf4c26165..a4a2ad6957a 100644 --- a/http/restore_service.go +++ b/http/restore_service.go @@ -9,13 +9,12 @@ import ( "strconv" "time" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" - "github.com/influxdata/influxdb/v2/v1/services/meta" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kit/tracing" + kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" + "github.com/influxdata/influxdb/v2/v1/services/meta" "go.uber.org/zap" ) diff --git a/http/router.go b/http/router.go index ada7e3f4dac..303c8478bc6 100644 --- a/http/router.go +++ b/http/router.go @@ -7,12 +7,11 @@ import ( "runtime/debug" "sync" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/go-stack/stack" "github.com/influxdata/httprouter" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" influxlogger "github.com/influxdata/influxdb/v2/logger" "go.uber.org/zap" diff --git a/http/router_test.go b/http/router_test.go index 932f73731ec..60156c63585 100644 --- a/http/router_test.go +++ b/http/router_test.go @@ -83,7 +83,7 @@ func TestRouter_NotFound(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - router := NewRouter(kithttp.ErrorHandler(0)) + router := NewRouter(kithttp.NewErrorHandler(zaptest.NewLogger(t))) router.HandlerFunc(tt.fields.method, tt.fields.path, tt.fields.handlerFn) r := httptest.NewRequest(tt.args.method, tt.args.path, nil) @@ -190,7 +190,7 @@ func TestRouter_Panic(t *testing.T) { tw := newTestLogWriter(t) panicLogger = zaptest.NewLogger(tw) - router := NewRouter(kithttp.ErrorHandler(0)) + router := NewRouter(kithttp.NewErrorHandler(zaptest.NewLogger(t))) router.HandlerFunc(tt.fields.method, tt.fields.path, tt.fields.handlerFn) r := httptest.NewRequest(tt.args.method, tt.args.path, nil) @@ -289,7 +289,7 @@ func TestRouter_MethodNotAllowed(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - router := NewRouter(kithttp.ErrorHandler(0)) + router := NewRouter(kithttp.NewErrorHandler(zaptest.NewLogger(t))) router.HandlerFunc(tt.fields.method, tt.fields.path, tt.fields.handlerFn) r := httptest.NewRequest(tt.args.method, tt.args.path, nil) diff --git a/http/scraper_service.go b/http/scraper_service.go index c43210d8dee..08272ecf824 100644 --- a/http/scraper_service.go +++ b/http/scraper_service.go @@ -8,12 +8,11 @@ import ( "net/http" "path" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" pctx "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "go.uber.org/zap" ) diff --git a/http/scraper_service_test.go b/http/scraper_service_test.go index ff70ffab4ef..a8c53dd2154 100644 --- a/http/scraper_service_test.go +++ b/http/scraper_service_test.go @@ -10,13 +10,12 @@ import ( "net/http/httptest" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" platcontext "github.com/influxdata/influxdb/v2/context" httpMock "github.com/influxdata/influxdb/v2/http/mock" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/mock" @@ -211,7 +210,7 @@ func TestService_handleGetScraperTargets(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { scraperBackend := NewMockScraperBackend(t) - scraperBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + scraperBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) scraperBackend.ScraperStorageService = tt.fields.ScraperTargetStoreService scraperBackend.OrganizationService = tt.fields.OrganizationService scraperBackend.BucketService = tt.fields.BucketService @@ -348,7 +347,7 @@ func TestService_handleGetScraperTarget(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { scraperBackend := NewMockScraperBackend(t) - scraperBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + scraperBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) scraperBackend.ScraperStorageService = tt.fields.ScraperTargetStoreService scraperBackend.OrganizationService = tt.fields.OrganizationService scraperBackend.BucketService = tt.fields.BucketService @@ -456,7 +455,7 @@ func TestService_handleDeleteScraperTarget(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { scraperBackend := NewMockScraperBackend(t) - scraperBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + scraperBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) scraperBackend.ScraperStorageService = tt.fields.Service h := NewScraperHandler(zaptest.NewLogger(t), scraperBackend) @@ -587,7 +586,7 @@ func TestService_handlePostScraperTarget(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { scraperBackend := NewMockScraperBackend(t) - scraperBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + scraperBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) scraperBackend.ScraperStorageService = tt.fields.ScraperTargetStoreService scraperBackend.OrganizationService = tt.fields.OrganizationService scraperBackend.BucketService = tt.fields.BucketService @@ -765,7 +764,7 @@ func TestService_handlePatchScraperTarget(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { scraperBackend := NewMockScraperBackend(t) - scraperBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + scraperBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) scraperBackend.ScraperStorageService = tt.fields.ScraperTargetStoreService scraperBackend.OrganizationService = tt.fields.OrganizationService scraperBackend.BucketService = tt.fields.BucketService @@ -843,7 +842,7 @@ func initScraperService(f platformtesting.TargetFields, t *testing.T) (influxdb. } scraperBackend := NewMockScraperBackend(t) - scraperBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + scraperBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) scraperBackend.ScraperStorageService = svc scraperBackend.OrganizationService = tenantService scraperBackend.BucketService = &mock.BucketService{ diff --git a/http/session_handler.go b/http/session_handler.go index e94253e18b5..582c7b6fe3e 100644 --- a/http/session_handler.go +++ b/http/session_handler.go @@ -4,10 +4,9 @@ import ( "context" "net/http" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" platform "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "go.uber.org/zap" ) diff --git a/http/session_test.go b/http/session_test.go index acc257e7fb1..85f4556a658 100644 --- a/http/session_test.go +++ b/http/session_test.go @@ -7,9 +7,8 @@ import ( "testing" "time" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" "go.uber.org/zap/zaptest" ) diff --git a/http/source_service.go b/http/source_service.go index 56eeca62fbb..a9f011558a6 100644 --- a/http/source_service.go +++ b/http/source_service.go @@ -7,14 +7,13 @@ import ( "net/http" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/flux" "github.com/influxdata/flux/csv" "github.com/influxdata/flux/lang" "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/pkg/httpc" "github.com/influxdata/influxdb/v2/query" "github.com/influxdata/influxdb/v2/query/influxql" diff --git a/http/source_service_test.go b/http/source_service_test.go index ee5534a8c92..235491cb932 100644 --- a/http/source_service_test.go +++ b/http/source_service_test.go @@ -4,9 +4,8 @@ import ( "reflect" "testing" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) func Test_newSourceResponse(t *testing.T) { diff --git a/http/task_service_test.go b/http/task_service_test.go index 8dd21a3ec33..1c592eb256d 100644 --- a/http/task_service_test.go +++ b/http/task_service_test.go @@ -396,7 +396,7 @@ func TestTaskHandler_handleGetTasks(t *testing.T) { w := httptest.NewRecorder() taskBackend := NewMockTaskBackend(t) - taskBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + taskBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) taskBackend.TaskService = tt.fields.taskService taskBackend.LabelService = tt.fields.labelService h := NewTaskHandler(zaptest.NewLogger(t), taskBackend) @@ -563,7 +563,7 @@ func TestTaskHandler_handlePostTasks(t *testing.T) { w := httptest.NewRecorder() taskBackend := NewMockTaskBackend(t) - taskBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + taskBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) taskBackend.TaskService = tt.fields.taskService h := NewTaskHandler(zaptest.NewLogger(t), taskBackend) h.handlePostTask(w, r) @@ -677,7 +677,7 @@ func TestTaskHandler_handleGetRun(t *testing.T) { r = r.WithContext(pcontext.SetAuthorizer(r.Context(), &influxdb.Authorization{Permissions: influxdb.OperPermissions()})) w := httptest.NewRecorder() taskBackend := NewMockTaskBackend(t) - taskBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + taskBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) taskBackend.TaskService = tt.fields.taskService h := NewTaskHandler(zaptest.NewLogger(t), taskBackend) h.handleGetRun(w, r) @@ -795,7 +795,7 @@ func TestTaskHandler_handleGetRuns(t *testing.T) { r = r.WithContext(pcontext.SetAuthorizer(r.Context(), &influxdb.Authorization{Permissions: influxdb.OperPermissions()})) w := httptest.NewRecorder() taskBackend := NewMockTaskBackend(t) - taskBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + taskBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) taskBackend.TaskService = tt.fields.taskService h := NewTaskHandler(zaptest.NewLogger(t), taskBackend) h.handleGetRuns(w, r) @@ -831,7 +831,7 @@ func TestTaskHandler_NotFoundStatus(t *testing.T) { labelService := label.NewService(labelStore) taskBackend := NewMockTaskBackend(t) - taskBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + taskBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) h := NewTaskHandler(zaptest.NewLogger(t), taskBackend) h.UserResourceMappingService = tenantService h.LabelService = labelService @@ -1374,7 +1374,7 @@ func TestTaskHandler_Sessions(t *testing.T) { newHandler := func(t *testing.T, ts *mock.TaskService) *TaskHandler { return NewTaskHandler(zaptest.NewLogger(t), &TaskBackend{ - HTTPErrorHandler: kithttp.ErrorHandler(0), + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), log: zaptest.NewLogger(t), TaskService: ts, diff --git a/http/telegraf.go b/http/telegraf.go index fe4b14ea2da..ab0243dcc9f 100644 --- a/http/telegraf.go +++ b/http/telegraf.go @@ -7,13 +7,12 @@ import ( "net/http" "strings" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/golang/gddo/httputil" "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" pctx "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/pkg/httpc" "github.com/influxdata/influxdb/v2/telegraf/plugins" "go.uber.org/zap" diff --git a/http/telegraf_test.go b/http/telegraf_test.go index 8b63d7e00be..2d4c343ef57 100644 --- a/http/telegraf_test.go +++ b/http/telegraf_test.go @@ -10,9 +10,8 @@ import ( "strings" "testing" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" "go.uber.org/zap/zaptest" ) diff --git a/http/user_resource_mapping_service.go b/http/user_resource_mapping_service.go index b270311c738..5150a7aba9c 100644 --- a/http/user_resource_mapping_service.go +++ b/http/user_resource_mapping_service.go @@ -7,11 +7,10 @@ import ( "net/http" "path" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/pkg/httpc" "go.uber.org/zap" ) diff --git a/http/user_resource_mapping_test.go b/http/user_resource_mapping_test.go index 0e9a9b85a53..e5f3cabbf53 100644 --- a/http/user_resource_mapping_test.go +++ b/http/user_resource_mapping_test.go @@ -10,10 +10,9 @@ import ( "net/http/httptest" "testing" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/httprouter" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" "go.uber.org/zap/zaptest" ) diff --git a/http/user_service.go b/http/user_service.go index 1d97a580012..e285e8e4716 100644 --- a/http/user_service.go +++ b/http/user_service.go @@ -6,12 +6,11 @@ import ( "fmt" "net/http" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/pkg/httpc" "go.uber.org/zap" ) diff --git a/http/user_test.go b/http/user_test.go index d7a6ba2bd68..c8434cc4a21 100644 --- a/http/user_test.go +++ b/http/user_test.go @@ -8,9 +8,8 @@ import ( "path" "testing" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/pkg/testttp" @@ -26,7 +25,7 @@ func NewMockUserBackend(t *testing.T) *UserBackend { UserService: mock.NewUserService(), UserOperationLogService: mock.NewUserOperationLogService(), PasswordsService: mock.NewPasswordsService(), - HTTPErrorHandler: kithttp.ErrorHandler(0), + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), } } @@ -46,7 +45,7 @@ func initUserService(f platformtesting.UserFields, t *testing.T) (platform.UserS } userBackend := NewMockUserBackend(t) - userBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + userBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) userBackend.UserService = tenantService handler := NewUserHandler(zaptest.NewLogger(t), userBackend) server := httptest.NewServer(handler) diff --git a/http/variable_service.go b/http/variable_service.go index 7e18c4d8c04..c39cece6b44 100644 --- a/http/variable_service.go +++ b/http/variable_service.go @@ -7,11 +7,10 @@ import ( "net/http" "strings" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/pkg/httpc" "go.uber.org/zap" ) diff --git a/http/variable_test.go b/http/variable_test.go index 8bd1b925bc2..7c03e28a4e4 100644 --- a/http/variable_test.go +++ b/http/variable_test.go @@ -12,11 +12,10 @@ import ( "testing" "time" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/mock" @@ -30,7 +29,7 @@ var faketime = time.Date(2006, 5, 4, 1, 2, 3, 0, time.UTC) // NewMockVariableBackend returns a VariableBackend with mock services. func NewMockVariableBackend(t *testing.T) *VariableBackend { return &VariableBackend{ - HTTPErrorHandler: kithttp.ErrorHandler(0), + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), log: zaptest.NewLogger(t), VariableService: mock.NewVariableService(), LabelService: mock.NewLabelService(), @@ -302,7 +301,7 @@ func TestVariableService_handleGetVariables(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { variableBackend := NewMockVariableBackend(t) - variableBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + variableBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) variableBackend.LabelService = tt.fields.LabelService variableBackend.VariableService = tt.fields.VariableService h := NewVariableHandler(zaptest.NewLogger(t), variableBackend) @@ -434,7 +433,7 @@ func TestVariableService_handleGetVariable(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { variableBackend := NewMockVariableBackend(t) - variableBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + variableBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) variableBackend.VariableService = tt.fields.VariableService h := NewVariableHandler(zaptest.NewLogger(t), variableBackend) r := httptest.NewRequest("GET", "http://howdy.tld", nil) @@ -573,7 +572,7 @@ func TestVariableService_handlePostVariable(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { variableBackend := NewMockVariableBackend(t) - variableBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + variableBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) variableBackend.VariableService = tt.fields.VariableService h := NewVariableHandler(zaptest.NewLogger(t), variableBackend) r := httptest.NewRequest("GET", "http://howdy.tld", bytes.NewReader([]byte(tt.args.variable))) @@ -667,7 +666,7 @@ func TestVariableService_handlePutVariable(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { variableBackend := NewMockVariableBackend(t) - variableBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + variableBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) variableBackend.VariableService = tt.fields.VariableService h := NewVariableHandler(zaptest.NewLogger(t), variableBackend) r := httptest.NewRequest("GET", "http://howdy.tld", bytes.NewReader([]byte(tt.args.variable))) @@ -776,7 +775,7 @@ func TestVariableService_handlePatchVariable(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { variableBackend := NewMockVariableBackend(t) - variableBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + variableBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) variableBackend.VariableService = tt.fields.VariableService h := NewVariableHandler(zaptest.NewLogger(t), variableBackend) r := httptest.NewRequest("GET", "http://howdy.tld", bytes.NewReader([]byte(tt.args.update))) @@ -870,7 +869,7 @@ func TestVariableService_handleDeleteVariable(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { variableBackend := NewMockVariableBackend(t) - variableBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + variableBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) variableBackend.VariableService = tt.fields.VariableService h := NewVariableHandler(zaptest.NewLogger(t), variableBackend) r := httptest.NewRequest("GET", "http://howdy.tld", nil) @@ -963,7 +962,7 @@ func TestService_handlePostVariableLabel(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { variableBackend := NewMockVariableBackend(t) - variableBackend.HTTPErrorHandler = kithttp.ErrorHandler(0) + variableBackend.HTTPErrorHandler = kithttp.NewErrorHandler(zaptest.NewLogger(t)) variableBackend.LabelService = tt.fields.LabelService h := NewVariableHandler(zaptest.NewLogger(t), variableBackend) diff --git a/http/write_handler.go b/http/write_handler.go index 3c3a38ce29c..0b5e84a4062 100644 --- a/http/write_handler.go +++ b/http/write_handler.go @@ -7,14 +7,13 @@ import ( "io" "net/http" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" pcontext "github.com/influxdata/influxdb/v2/context" "github.com/influxdata/influxdb/v2/http/metric" "github.com/influxdata/influxdb/v2/http/points" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kit/tracing" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/models" diff --git a/http/write_handler_test.go b/http/write_handler_test.go index 97e0ea3451b..6baf32c4914 100644 --- a/http/write_handler_test.go +++ b/http/write_handler_test.go @@ -11,12 +11,11 @@ import ( "strings" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/http/metric" httpmock "github.com/influxdata/influxdb/v2/http/mock" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/mock" influxtesting "github.com/influxdata/influxdb/v2/testing" @@ -389,7 +388,7 @@ func TestWriteHandler_handleWrite(t *testing.T) { } b := &APIBackend{ - HTTPErrorHandler: DefaultErrorHandler, + HTTPErrorHandler: kithttp.NewErrorHandler(zaptest.NewLogger(t)), Logger: zaptest.NewLogger(t), OrganizationService: orgs, BucketService: buckets, @@ -423,8 +422,6 @@ func TestWriteHandler_handleWrite(t *testing.T) { } } -var DefaultErrorHandler = kithttp.ErrorHandler(0) - func bucketWritePermission(org, bucket string) *influxdb.Authorization { oid := influxtesting.MustIDBase16(org) bid := influxtesting.MustIDBase16(bucket) diff --git a/http/write_usage_recorder.go b/http/write_usage_recorder.go index 2634710a606..c1fec2f329f 100644 --- a/http/write_usage_recorder.go +++ b/http/write_usage_recorder.go @@ -3,9 +3,8 @@ package http import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/http/metric" + "github.com/influxdata/influxdb/v2/kit/platform" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" ) diff --git a/influxql/query/executor.go b/influxql/query/executor.go index befb4183822..1ddd5b04aaf 100644 --- a/influxql/query/executor.go +++ b/influxql/query/executor.go @@ -9,10 +9,9 @@ import ( "strconv" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - iql "github.com/influxdata/influxdb/v2/influxql" "github.com/influxdata/influxdb/v2/influxql/control" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxql" diff --git a/influxql/query/iterator.go b/influxql/query/iterator.go index 8928d214f93..02297dd1be3 100644 --- a/influxql/query/iterator.go +++ b/influxql/query/iterator.go @@ -9,10 +9,9 @@ import ( "regexp" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/gogo/protobuf/proto" internal "github.com/influxdata/influxdb/v2/influxql/query/internal" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxql" ) diff --git a/influxql/query/proxy_executor.go b/influxql/query/proxy_executor.go index 241cc489cfd..1d41e4be751 100644 --- a/influxql/query/proxy_executor.go +++ b/influxql/query/proxy_executor.go @@ -6,10 +6,9 @@ import ( "strings" "time" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - iql "github.com/influxdata/influxdb/v2/influxql" "github.com/influxdata/influxdb/v2/kit/check" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kit/tracing" influxlogger "github.com/influxdata/influxdb/v2/logger" "github.com/influxdata/influxql" diff --git a/influxql/query/select.go b/influxql/query/select.go index 1f0d203bb03..9543961d48c 100644 --- a/influxql/query/select.go +++ b/influxql/query/select.go @@ -8,10 +8,9 @@ import ( "sync" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - iql "github.com/influxdata/influxdb/v2/influxql" "github.com/influxdata/influxdb/v2/influxql/query/internal/gota" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxql" "golang.org/x/sync/errgroup" ) diff --git a/influxql/query_request.go b/influxql/query_request.go index 7b7b3e380e4..3792c3ae57f 100644 --- a/influxql/query_request.go +++ b/influxql/query_request.go @@ -3,10 +3,9 @@ package influxql import ( "encoding/json" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" ) type EncodingFormat int diff --git a/inmem/service.go b/inmem/service.go index 7344c4d8547..cbeea3877a7 100644 --- a/inmem/service.go +++ b/inmem/service.go @@ -4,9 +4,8 @@ import ( "context" "sync" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/rand" "github.com/influxdata/influxdb/v2/snowflake" ) diff --git a/inmem/source.go b/inmem/source.go index 57018937894..aba973eb1ee 100644 --- a/inmem/source.go +++ b/inmem/source.go @@ -4,10 +4,9 @@ import ( "context" "fmt" + platform "github.com/influxdata/influxdb/v2" platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - platform "github.com/influxdata/influxdb/v2" ) // DefaultSource is the default source. diff --git a/jsonweb/token.go b/jsonweb/token.go index f409e562c60..7a197f41cab 100644 --- a/jsonweb/token.go +++ b/jsonweb/token.go @@ -3,10 +3,9 @@ package jsonweb import ( "errors" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/golang-jwt/jwt" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) const kind = "jwt" diff --git a/jsonweb/token_test.go b/jsonweb/token_test.go index 3af0ab101ef..77a79678e04 100644 --- a/jsonweb/token_test.go +++ b/jsonweb/token_test.go @@ -4,11 +4,10 @@ import ( "reflect" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/golang-jwt/jwt" "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var ( diff --git a/kit/cli/viper.go b/kit/cli/viper.go index 7cbbb5f5295..8dce3f25878 100644 --- a/kit/cli/viper.go +++ b/kit/cli/viper.go @@ -8,7 +8,6 @@ import ( "time" "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/spf13/cast" "github.com/spf13/cobra" "github.com/spf13/pflag" diff --git a/kit/metric/client.go b/kit/metric/client.go index 299a86ec1bb..ca31abec9e6 100644 --- a/kit/metric/client.go +++ b/kit/metric/client.go @@ -4,7 +4,6 @@ import ( "time" "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/prometheus/client_golang/prometheus" ) diff --git a/kit/platform/errors/errors_test.go b/kit/platform/errors/errors_test.go index 597b156081d..e9f9ae14c47 100644 --- a/kit/platform/errors/errors_test.go +++ b/kit/platform/errors/errors_test.go @@ -4,8 +4,9 @@ import ( "encoding/json" "errors" "fmt" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "testing" + + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" ) const EFailedToGetStorageHost = "failed to get the storage host" diff --git a/kit/platform/id_test.go b/kit/platform/id_test.go index 00090bd894b..9b5fc44b4d6 100644 --- a/kit/platform/id_test.go +++ b/kit/platform/id_test.go @@ -4,10 +4,10 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform" "reflect" "testing" + "github.com/influxdata/influxdb/v2/kit/platform" platformtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/kit/tracing/tracing.go b/kit/tracing/tracing.go index 45d99b8c50a..fa82af3d619 100644 --- a/kit/tracing/tracing.go +++ b/kit/tracing/tracing.go @@ -9,13 +9,12 @@ import ( "time" "github.com/go-chi/chi" - "github.com/prometheus/client_golang/prometheus" - "github.com/uber/jaeger-client-go" - "github.com/influxdata/httprouter" "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" "github.com/opentracing/opentracing-go/log" + "github.com/prometheus/client_golang/prometheus" + "github.com/uber/jaeger-client-go" ) // LogError adds a span log for an error. diff --git a/kit/transport/http/api.go b/kit/transport/http/api.go index 69a2983ae28..2257991295f 100644 --- a/kit/transport/http/api.go +++ b/kit/transport/http/api.go @@ -10,7 +10,6 @@ import ( "net/http" "github.com/influxdata/influxdb/v2/kit/platform/errors" - "go.uber.org/zap" ) diff --git a/kit/transport/http/api_test.go b/kit/transport/http/api_test.go index ae233afa335..b72df6b57c7 100644 --- a/kit/transport/http/api_test.go +++ b/kit/transport/http/api_test.go @@ -5,12 +5,12 @@ import ( "encoding/gob" "encoding/json" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "io" "net/http" "strings" "testing" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/pkg/testttp" "github.com/stretchr/testify/assert" diff --git a/kit/transport/http/error_handler.go b/kit/transport/http/error_handler.go index 166c94d3202..8eb185fc985 100644 --- a/kit/transport/http/error_handler.go +++ b/kit/transport/http/error_handler.go @@ -12,10 +12,17 @@ import ( "strings" errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" + "go.uber.org/zap" ) // ErrorHandler is the error handler in http package. -type ErrorHandler int +type ErrorHandler struct { + logger *zap.Logger +} + +func NewErrorHandler(logger *zap.Logger) ErrorHandler { + return ErrorHandler{logger: logger} +} // HandleHTTPError encodes err with the appropriate status code and format, // sets the X-Platform-Error-Code headers on the response. @@ -28,10 +35,11 @@ func (h ErrorHandler) HandleHTTPError(ctx context.Context, err error, w http.Res code := errors2.ErrorCode(err) var msg string - if err, ok := err.(*errors2.Error); ok { + if _, ok := err.(*errors2.Error); ok { msg = err.Error() } else { - msg = "An internal error has occurred" + msg = "An internal error has occurred - check server logs" + h.logger.Warn("internal error not returned to client", zap.Error(err)) } WriteErrorResponse(ctx, w, code, msg) diff --git a/kit/transport/http/error_handler_test.go b/kit/transport/http/error_handler_test.go index 0ebd19553d5..60fe89e78a2 100644 --- a/kit/transport/http/error_handler_test.go +++ b/kit/transport/http/error_handler_test.go @@ -3,12 +3,13 @@ package http_test import ( "context" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "net/http/httptest" "testing" "github.com/influxdata/influxdb/v2/http" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" + "go.uber.org/zap/zaptest" ) func TestEncodeError(t *testing.T) { @@ -16,7 +17,7 @@ func TestEncodeError(t *testing.T) { w := httptest.NewRecorder() - kithttp.ErrorHandler(0).HandleHTTPError(ctx, nil, w) + kithttp.NewErrorHandler(zaptest.NewLogger(t)).HandleHTTPError(ctx, nil, w) if w.Code != 200 { t.Errorf("expected status code 200, got: %d", w.Code) @@ -33,7 +34,7 @@ func TestEncodeErrorWithError(t *testing.T) { w := httptest.NewRecorder() - kithttp.ErrorHandler(0).HandleHTTPError(ctx, err, w) + kithttp.NewErrorHandler(zaptest.NewLogger(t)).HandleHTTPError(ctx, err, w) if w.Code != 500 { t.Errorf("expected status code 500, got: %d", w.Code) diff --git a/kit/transport/http/middleware.go b/kit/transport/http/middleware.go index cd67fea41e6..2dd0889b78a 100644 --- a/kit/transport/http/middleware.go +++ b/kit/transport/http/middleware.go @@ -9,10 +9,9 @@ import ( "strings" "time" + "github.com/go-chi/chi" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/go-chi/chi" "github.com/influxdata/influxdb/v2/kit/tracing" ua "github.com/mileusna/useragent" "github.com/prometheus/client_golang/prometheus" diff --git a/kv/document.go b/kv/document.go index 9c16adcbde9..87ac6322dd9 100644 --- a/kv/document.go +++ b/kv/document.go @@ -5,10 +5,9 @@ import ( "encoding/json" "path" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" ) const ( diff --git a/kv/kvlog.go b/kv/kvlog.go index 92be19470aa..5e73f7b0cac 100644 --- a/kv/kvlog.go +++ b/kv/kvlog.go @@ -9,9 +9,8 @@ import ( "fmt" "time" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - platform "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" ) var ( diff --git a/kv/migration/all/0003_task_owners_test.go b/kv/migration/all/0003_task_owners_test.go index 2c195ae577e..fe22c1c4d81 100644 --- a/kv/migration/all/0003_task_owners_test.go +++ b/kv/migration/all/0003_task_owners_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kv" ) diff --git a/kv/migration/all/0011_populate-dashboards-owner-id.go b/kv/migration/all/0011_populate-dashboards-owner-id.go index e2977fe538a..22559c36a96 100644 --- a/kv/migration/all/0011_populate-dashboards-owner-id.go +++ b/kv/migration/all/0011_populate-dashboards-owner-id.go @@ -5,9 +5,8 @@ import ( "encoding/json" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv" ) diff --git a/kv/migration/all/0013_repair-DBRP-owner-and-bucket-IDs.go b/kv/migration/all/0013_repair-DBRP-owner-and-bucket-IDs.go index cdc4fb9657d..6a996d42e40 100644 --- a/kv/migration/all/0013_repair-DBRP-owner-and-bucket-IDs.go +++ b/kv/migration/all/0013_repair-DBRP-owner-and-bucket-IDs.go @@ -5,7 +5,6 @@ import ( "encoding/json" "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kv" ) diff --git a/kv/migration/all/0015_record-shard-group-durations-in-bucket-metadata.go b/kv/migration/all/0015_record-shard-group-durations-in-bucket-metadata.go index f2542a54bb4..1bddbfd4517 100644 --- a/kv/migration/all/0015_record-shard-group-durations-in-bucket-metadata.go +++ b/kv/migration/all/0015_record-shard-group-durations-in-bucket-metadata.go @@ -6,7 +6,6 @@ import ( "time" "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/v1/services/meta" ) diff --git a/kv/migration/all/0015_record-shard-group-durations-in-bucket-metadata_test.go b/kv/migration/all/0015_record-shard-group-durations-in-bucket-metadata_test.go index a7bd7804d1a..99125a040fa 100644 --- a/kv/migration/all/0015_record-shard-group-durations-in-bucket-metadata_test.go +++ b/kv/migration/all/0015_record-shard-group-durations-in-bucket-metadata_test.go @@ -6,10 +6,9 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/dustin/go-humanize" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv" "github.com/stretchr/testify/require" ) diff --git a/kv/migration/migration.go b/kv/migration/migration.go index 6ba3090dab2..66c80fadc51 100644 --- a/kv/migration/migration.go +++ b/kv/migration/migration.go @@ -8,7 +8,6 @@ import ( "time" "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kv" "go.uber.org/zap" ) diff --git a/kv/mock/bucket.go b/kv/mock/bucket.go index 7a9fd8b8262..062bb3eac98 100644 --- a/kv/mock/bucket.go +++ b/kv/mock/bucket.go @@ -5,9 +5,10 @@ package mock import ( + reflect "reflect" + gomock "github.com/golang/mock/gomock" kv "github.com/influxdata/influxdb/v2/kv" - reflect "reflect" ) // MockBucket is a mock of Bucket interface diff --git a/kv/mock/forward_cursor.go b/kv/mock/forward_cursor.go index cc066398065..2faf2f6c0c5 100644 --- a/kv/mock/forward_cursor.go +++ b/kv/mock/forward_cursor.go @@ -5,8 +5,9 @@ package mock import ( - gomock "github.com/golang/mock/gomock" reflect "reflect" + + gomock "github.com/golang/mock/gomock" ) // MockForwardCursor is a mock of ForwardCursor interface diff --git a/kv/mock/tx.go b/kv/mock/tx.go index 3a326fa12d6..6f560bba84f 100644 --- a/kv/mock/tx.go +++ b/kv/mock/tx.go @@ -6,9 +6,10 @@ package mock import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" kv "github.com/influxdata/influxdb/v2/kv" - reflect "reflect" ) // MockTx is a mock of Tx interface diff --git a/kv/scrapers.go b/kv/scrapers.go index b405c06a310..4fc6d060ac2 100644 --- a/kv/scrapers.go +++ b/kv/scrapers.go @@ -5,10 +5,9 @@ import ( "encoding/json" "fmt" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" ) var ( diff --git a/kv/source.go b/kv/source.go index c2062491eff..43ddc6f041e 100644 --- a/kv/source.go +++ b/kv/source.go @@ -5,10 +5,9 @@ import ( "encoding/json" "fmt" + influxdb "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - influxdb "github.com/influxdata/influxdb/v2" ) var ( diff --git a/kv/store_base.go b/kv/store_base.go index ab0f39ce9b6..2b654550b29 100644 --- a/kv/store_base.go +++ b/kv/store_base.go @@ -8,7 +8,6 @@ import ( "github.com/influxdata/influxdb/v2/kit/platform" errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/opentracing/opentracing-go" ) diff --git a/kv/store_index.go b/kv/store_index.go index 23b8b5e0d37..e4f342448fe 100644 --- a/kv/store_index.go +++ b/kv/store_index.go @@ -6,9 +6,8 @@ import ( "errors" "fmt" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - ierrors "github.com/influxdata/influxdb/v2/kit/errors" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kit/tracing" ) diff --git a/kv/variable.go b/kv/variable.go index 3c9deb9a0eb..206d8dc81ff 100644 --- a/kv/variable.go +++ b/kv/variable.go @@ -5,10 +5,9 @@ import ( "encoding/json" "strings" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" ) var ( diff --git a/label/http_client.go b/label/http_client.go index b47c63a74cd..e8a22d50ca9 100644 --- a/label/http_client.go +++ b/label/http_client.go @@ -4,9 +4,8 @@ import ( "context" "path" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/pkg/httpc" ) diff --git a/label/http_handler.go b/label/http_handler.go index 3875d474bc1..50bc7b0c8f5 100644 --- a/label/http_handler.go +++ b/label/http_handler.go @@ -5,12 +5,11 @@ import ( "fmt" "net/http" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "go.uber.org/zap" ) diff --git a/label/http_server.go b/label/http_server.go index a7c185001e2..0e05690fa7b 100644 --- a/label/http_server.go +++ b/label/http_server.go @@ -5,11 +5,10 @@ import ( "fmt" "net/http" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "go.uber.org/zap" ) diff --git a/label/http_server_test.go b/label/http_server_test.go index 34a4324abee..45769ca9615 100644 --- a/label/http_server_test.go +++ b/label/http_server_test.go @@ -10,12 +10,11 @@ import ( "net/http/httptest" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/google/go-cmp/cmp" influxdb "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" "github.com/yudai/gojsondiff" diff --git a/label/middleware_auth.go b/label/middleware_auth.go index bc65b4afaab..9b202b36ec6 100644 --- a/label/middleware_auth.go +++ b/label/middleware_auth.go @@ -3,10 +3,9 @@ package label import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.LabelService = (*AuthedLabelService)(nil) diff --git a/label/middleware_auth_test.go b/label/middleware_auth_test.go index f7f7d08134e..64adc9ac2fd 100644 --- a/label/middleware_auth_test.go +++ b/label/middleware_auth_test.go @@ -6,12 +6,11 @@ import ( "sort" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/label/middleware_logging.go b/label/middleware_logging.go index 1e97e917cf7..ca8d3ad2279 100644 --- a/label/middleware_logging.go +++ b/label/middleware_logging.go @@ -5,9 +5,8 @@ import ( "fmt" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "go.uber.org/zap" ) diff --git a/label/middleware_metrics.go b/label/middleware_metrics.go index d6a60848c98..df7cbc1544a 100644 --- a/label/middleware_metrics.go +++ b/label/middleware_metrics.go @@ -3,10 +3,9 @@ package label import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/metric" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/prometheus/client_golang/prometheus" ) diff --git a/label/middleware_metrics_test.go b/label/middleware_metrics_test.go index f08d9de4907..f35f0028c13 100644 --- a/label/middleware_metrics_test.go +++ b/label/middleware_metrics_test.go @@ -6,9 +6,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/prom" "github.com/influxdata/influxdb/v2/label" - "go.uber.org/zap" - influxdbtesting "github.com/influxdata/influxdb/v2/testing" + "go.uber.org/zap" ) func TestLabelMetricsService(t *testing.T) { diff --git a/label/service.go b/label/service.go index e470de2e7c2..e1419ce7bc6 100644 --- a/label/service.go +++ b/label/service.go @@ -4,10 +4,9 @@ import ( "context" "strings" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kv" ) diff --git a/label/storage.go b/label/storage.go index 07ff8e8291b..85394b8ef91 100644 --- a/label/storage.go +++ b/label/storage.go @@ -5,7 +5,6 @@ import ( "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/snowflake" diff --git a/label/storage_label.go b/label/storage_label.go index b88cc269b59..167ca6f6aef 100644 --- a/label/storage_label.go +++ b/label/storage_label.go @@ -6,10 +6,9 @@ import ( "fmt" "strings" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kv" ) diff --git a/label/storage_test.go b/label/storage_test.go index fe3ea8fdc0d..a941a7e6dc3 100644 --- a/label/storage_test.go +++ b/label/storage_test.go @@ -3,12 +3,12 @@ package label_test import ( "context" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform" "reflect" "testing" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/inmem" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/kv/migration/all" "github.com/influxdata/influxdb/v2/label" diff --git a/label_test.go b/label_test.go index e3868f0b095..4ae887c2cf4 100644 --- a/label_test.go +++ b/label_test.go @@ -1,10 +1,10 @@ package influxdb_test import ( - "github.com/influxdata/influxdb/v2/kit/platform" "testing" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" influxtest "github.com/influxdata/influxdb/v2/testing" ) diff --git a/mock/annotation_service.go b/mock/annotation_service.go index b7b5fd4999f..1ec16846c25 100644 --- a/mock/annotation_service.go +++ b/mock/annotation_service.go @@ -6,10 +6,11 @@ package mock import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" influxdb "github.com/influxdata/influxdb/v2" platform "github.com/influxdata/influxdb/v2/kit/platform" - reflect "reflect" ) // MockAnnotationService is a mock of AnnotationService interface diff --git a/mock/auth_service.go b/mock/auth_service.go index 280ef158bbb..758d5872480 100644 --- a/mock/auth_service.go +++ b/mock/auth_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) // AuthorizationService is a mock implementation of a retention.AuthorizationService, which diff --git a/mock/bucket_service.go b/mock/bucket_service.go index 72339898fd1..0e4cfe4652c 100644 --- a/mock/bucket_service.go +++ b/mock/bucket_service.go @@ -4,9 +4,8 @@ import ( "context" "time" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) // BucketService is a mock implementation of a retention.BucketService, which diff --git a/mock/check_service.go b/mock/check_service.go index 2c770c3c738..9498058a13a 100644 --- a/mock/check_service.go +++ b/mock/check_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) // CheckService is a mock implementation of a retention.CheckService, which diff --git a/mock/dashboard_service.go b/mock/dashboard_service.go index 5db6f78d6c3..80aa18e2192 100644 --- a/mock/dashboard_service.go +++ b/mock/dashboard_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) var _ platform.DashboardService = &DashboardService{} diff --git a/mock/dbrp_mapping.go b/mock/dbrp_mapping.go index d86a044d611..6937f735bd9 100644 --- a/mock/dbrp_mapping.go +++ b/mock/dbrp_mapping.go @@ -3,9 +3,8 @@ package mock import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.DBRPMappingService = (*DBRPMappingService)(nil) diff --git a/mock/delete.go b/mock/delete.go index 8f77819f940..08b35210154 100644 --- a/mock/delete.go +++ b/mock/delete.go @@ -3,9 +3,8 @@ package mock import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.DeleteService = &DeleteService{} diff --git a/mock/document_service.go b/mock/document_service.go index a8f5d786fb3..ca9e5afc1f2 100644 --- a/mock/document_service.go +++ b/mock/document_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.DocumentStore = &DocumentStore{} diff --git a/mock/label_service.go b/mock/label_service.go index ed49aee55ba..9aed8fac0f9 100644 --- a/mock/label_service.go +++ b/mock/label_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) var _ platform.LabelService = &LabelService{} diff --git a/mock/lookup_service.go b/mock/lookup_service.go index a64f75420f1..cd9f6c64691 100644 --- a/mock/lookup_service.go +++ b/mock/lookup_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) // LookupService provides field lookup for the resource and ID. diff --git a/mock/notification_endpoint_service.go b/mock/notification_endpoint_service.go index aba06db7fce..c35a3d61c6d 100644 --- a/mock/notification_endpoint_service.go +++ b/mock/notification_endpoint_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.NotificationEndpointService = &NotificationEndpointService{} diff --git a/mock/notification_rule_store.go b/mock/notification_rule_store.go index b7691d176ca..277b5a90a14 100644 --- a/mock/notification_rule_store.go +++ b/mock/notification_rule_store.go @@ -3,9 +3,8 @@ package mock import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.NotificationRuleStore = &NotificationRuleStore{} diff --git a/mock/operation_log_service.go b/mock/operation_log_service.go index 377b09c8fe0..12502c05418 100644 --- a/mock/operation_log_service.go +++ b/mock/operation_log_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) var _ platform.BucketOperationLogService = (*BucketOperationLogService)(nil) diff --git a/mock/org_service.go b/mock/org_service.go index daf8741d352..28970d8fa6c 100644 --- a/mock/org_service.go +++ b/mock/org_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) var _ platform.OrganizationService = &OrganizationService{} diff --git a/mock/passwords_service.go b/mock/passwords_service.go index 70b8604333e..512deccc910 100644 --- a/mock/passwords_service.go +++ b/mock/passwords_service.go @@ -6,9 +6,10 @@ package mock import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" "github.com/influxdata/influxdb/v2/kit/platform" - reflect "reflect" ) // MockPasswordsService is a mock of PasswordsService interface diff --git a/mock/points_writer.go b/mock/points_writer.go index 78d13ea0147..b2765c76926 100644 --- a/mock/points_writer.go +++ b/mock/points_writer.go @@ -5,7 +5,6 @@ import ( "sync" "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/models" ) diff --git a/mock/scraper_service.go b/mock/scraper_service.go index ff9c9a4774c..1b58e098a7e 100644 --- a/mock/scraper_service.go +++ b/mock/scraper_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) var _ platform.ScraperTargetStoreService = &ScraperTargetStoreService{} diff --git a/mock/source_service.go b/mock/source_service.go index 413c6d08b24..381d5f624db 100644 --- a/mock/source_service.go +++ b/mock/source_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) var _ platform.SourceService = (*SourceService)(nil) diff --git a/mock/telegraf_service.go b/mock/telegraf_service.go index 2801e45520b..c05cf0cbafd 100644 --- a/mock/telegraf_service.go +++ b/mock/telegraf_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) var _ platform.TelegrafConfigStore = (*TelegrafConfigStore)(nil) diff --git a/mock/user_resource_mapping_service.go b/mock/user_resource_mapping_service.go index eea56274b65..d8cbffaf96c 100644 --- a/mock/user_resource_mapping_service.go +++ b/mock/user_resource_mapping_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) var _ platform.UserResourceMappingService = &UserResourceMappingService{} diff --git a/mock/user_service.go b/mock/user_service.go index a3cc6da6c23..398b5a62636 100644 --- a/mock/user_service.go +++ b/mock/user_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) var _ platform.UserService = (*UserService)(nil) diff --git a/mock/variable_service.go b/mock/variable_service.go index d584a3e8181..541baf44abe 100644 --- a/mock/variable_service.go +++ b/mock/variable_service.go @@ -3,9 +3,8 @@ package mock import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.VariableService = &VariableService{} diff --git a/notification/check/check_test.go b/notification/check/check_test.go index f70e286833a..c2c62a27c99 100644 --- a/notification/check/check_test.go +++ b/notification/check/check_test.go @@ -5,20 +5,19 @@ import ( "testing" "time" - "github.com/influxdata/flux/ast" - "github.com/influxdata/flux/ast/astutil" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/stretchr/testify/require" - "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" + "github.com/influxdata/flux/ast" + "github.com/influxdata/flux/ast/astutil" "github.com/influxdata/flux/parser" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/notification" "github.com/influxdata/influxdb/v2/notification/check" "github.com/influxdata/influxdb/v2/query/fluxlang" influxTesting "github.com/influxdata/influxdb/v2/testing" + "github.com/stretchr/testify/require" ) const ( diff --git a/notification/endpoint/endpoint.go b/notification/endpoint/endpoint.go index 0ca21108884..9ada557d516 100644 --- a/notification/endpoint/endpoint.go +++ b/notification/endpoint/endpoint.go @@ -4,10 +4,9 @@ import ( "encoding/json" "fmt" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" ) // types of endpoints. diff --git a/notification/endpoint/endpoint_test.go b/notification/endpoint/endpoint_test.go index 32c172a7f14..eec3cb8e6a2 100644 --- a/notification/endpoint/endpoint_test.go +++ b/notification/endpoint/endpoint_test.go @@ -3,7 +3,6 @@ package endpoint_test import ( "encoding/json" "fmt" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "net/http" "net/url" "testing" @@ -12,6 +11,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/errors" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/notification/endpoint" influxTesting "github.com/influxdata/influxdb/v2/testing" diff --git a/notification/endpoint/http.go b/notification/endpoint/http.go index 3929afeaee5..062c9e53146 100644 --- a/notification/endpoint/http.go +++ b/notification/endpoint/http.go @@ -7,9 +7,8 @@ import ( "net/http" "net/url" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" ) var _ influxdb.NotificationEndpoint = &HTTP{} diff --git a/notification/endpoint/pagerduty.go b/notification/endpoint/pagerduty.go index 7ec2299088f..a13d73e7d88 100644 --- a/notification/endpoint/pagerduty.go +++ b/notification/endpoint/pagerduty.go @@ -3,9 +3,8 @@ package endpoint import ( "encoding/json" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" ) var _ influxdb.NotificationEndpoint = &PagerDuty{} diff --git a/notification/endpoint/service/service.go b/notification/endpoint/service/service.go index ad7edc32992..1cc72915a13 100644 --- a/notification/endpoint/service/service.go +++ b/notification/endpoint/service/service.go @@ -3,9 +3,8 @@ package service import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - influxdb "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) // Service provides all the notification endpoint service behavior. diff --git a/notification/endpoint/service/store.go b/notification/endpoint/service/store.go index 938b1986dba..1dc3fb09d9e 100644 --- a/notification/endpoint/service/store.go +++ b/notification/endpoint/service/store.go @@ -3,10 +3,9 @@ package service import ( "context" + influxdb "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - influxdb "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/notification/endpoint" "github.com/influxdata/influxdb/v2/snowflake" diff --git a/notification/endpoint/service/testing/service.go b/notification/endpoint/service/testing/service.go index 7f67d1f6ced..408b18d82bc 100644 --- a/notification/endpoint/service/testing/service.go +++ b/notification/endpoint/service/testing/service.go @@ -9,11 +9,10 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" influxdb "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/notification/endpoint" "github.com/stretchr/testify/assert" diff --git a/notification/endpoint/slack.go b/notification/endpoint/slack.go index 3e5f1cff80a..f164475b00a 100644 --- a/notification/endpoint/slack.go +++ b/notification/endpoint/slack.go @@ -5,9 +5,8 @@ import ( "fmt" "net/url" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" ) var _ influxdb.NotificationEndpoint = &Slack{} diff --git a/notification/endpoint/telegram.go b/notification/endpoint/telegram.go index 595bf9d2b00..64541cea3f1 100644 --- a/notification/endpoint/telegram.go +++ b/notification/endpoint/telegram.go @@ -3,9 +3,8 @@ package endpoint import ( "encoding/json" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" ) var _ influxdb.NotificationEndpoint = &Telegram{} diff --git a/notification/endpoint/testing/service.go b/notification/endpoint/testing/service.go index 7f67d1f6ced..408b18d82bc 100644 --- a/notification/endpoint/testing/service.go +++ b/notification/endpoint/testing/service.go @@ -9,11 +9,10 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" influxdb "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/notification/endpoint" "github.com/stretchr/testify/assert" diff --git a/notification/rule/http_test.go b/notification/rule/http_test.go index 62fee572f41..2f445bd2c7f 100644 --- a/notification/rule/http_test.go +++ b/notification/rule/http_test.go @@ -3,14 +3,13 @@ package rule_test import ( "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/notification" "github.com/influxdata/influxdb/v2/notification/endpoint" "github.com/influxdata/influxdb/v2/notification/rule" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestHTTP_GenerateFlux(t *testing.T) { diff --git a/notification/rule/pagerduty.go b/notification/rule/pagerduty.go index 18ef5e8df1d..08093698f89 100644 --- a/notification/rule/pagerduty.go +++ b/notification/rule/pagerduty.go @@ -4,11 +4,10 @@ import ( "encoding/json" "fmt" - "github.com/influxdata/flux/ast/astutil" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/flux/ast" + "github.com/influxdata/flux/ast/astutil" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/notification/endpoint" "github.com/influxdata/influxdb/v2/notification/flux" ) diff --git a/notification/rule/rule.go b/notification/rule/rule.go index 38082f61506..39751af8c14 100644 --- a/notification/rule/rule.go +++ b/notification/rule/rule.go @@ -6,11 +6,10 @@ import ( "strings" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/flux/ast" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/notification" "github.com/influxdata/influxdb/v2/notification/flux" ) diff --git a/notification/rule/rule_test.go b/notification/rule/rule_test.go index 4dd2701288d..0a8463e2a42 100644 --- a/notification/rule/rule_test.go +++ b/notification/rule/rule_test.go @@ -2,12 +2,12 @@ package rule_test import ( "encoding/json" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "testing" "time" "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/notification" "github.com/influxdata/influxdb/v2/notification/rule" diff --git a/notification/rule/slack.go b/notification/rule/slack.go index 1b5c3949d41..137c6c156b4 100644 --- a/notification/rule/slack.go +++ b/notification/rule/slack.go @@ -4,11 +4,10 @@ import ( "encoding/json" "fmt" - "github.com/influxdata/flux/ast/astutil" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/flux/ast" + "github.com/influxdata/flux/ast/astutil" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/notification/endpoint" "github.com/influxdata/influxdb/v2/notification/flux" ) diff --git a/notification/rule/slack_test.go b/notification/rule/slack_test.go index 06fc866645b..3ce47527e27 100644 --- a/notification/rule/slack_test.go +++ b/notification/rule/slack_test.go @@ -3,11 +3,10 @@ package rule_test import ( "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/flux/ast" "github.com/influxdata/flux/parser" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/notification" "github.com/influxdata/influxdb/v2/notification/endpoint" "github.com/influxdata/influxdb/v2/notification/rule" diff --git a/notification/rule/telegram.go b/notification/rule/telegram.go index ee30df75768..7f6c553b1e5 100644 --- a/notification/rule/telegram.go +++ b/notification/rule/telegram.go @@ -4,11 +4,10 @@ import ( "encoding/json" "fmt" - "github.com/influxdata/flux/ast/astutil" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/flux/ast" + "github.com/influxdata/flux/ast/astutil" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/notification/endpoint" "github.com/influxdata/influxdb/v2/notification/flux" ) diff --git a/notification/rule/telegram_test.go b/notification/rule/telegram_test.go index 484a01f6e71..fa5665e89bb 100644 --- a/notification/rule/telegram_test.go +++ b/notification/rule/telegram_test.go @@ -3,10 +3,9 @@ package rule_test import ( "testing" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/andreyvit/diff" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/notification" "github.com/influxdata/influxdb/v2/notification/endpoint" "github.com/influxdata/influxdb/v2/notification/rule" diff --git a/pkg/httpc/req.go b/pkg/httpc/req.go index 792c3904904..ac4cd66529a 100644 --- a/pkg/httpc/req.go +++ b/pkg/httpc/req.go @@ -12,7 +12,6 @@ import ( "strings" "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2/kit/tracing" ) diff --git a/pkg/jsonnet/decode_test.go b/pkg/jsonnet/decode_test.go index 15d457c8097..eb261a1261c 100644 --- a/pkg/jsonnet/decode_test.go +++ b/pkg/jsonnet/decode_test.go @@ -4,9 +4,8 @@ import ( "strings" "testing" - "github.com/stretchr/testify/assert" - "github.com/influxdata/influxdb/v2/pkg/jsonnet" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/jsonparser/jsonparser_test.go b/pkg/jsonparser/jsonparser_test.go index 8efba35f74d..27b2761525d 100644 --- a/pkg/jsonparser/jsonparser_test.go +++ b/pkg/jsonparser/jsonparser_test.go @@ -1,10 +1,10 @@ package jsonparser_test import ( - "github.com/influxdata/influxdb/v2/kit/platform" "testing" "github.com/google/go-cmp/cmp" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/pkg/jsonparser" ) diff --git a/pkger/http_remote_service.go b/pkger/http_remote_service.go index fdd831b480d..c22e81b567f 100644 --- a/pkger/http_remote_service.go +++ b/pkger/http_remote_service.go @@ -5,10 +5,9 @@ import ( "encoding/json" "net/http" + ihttp "github.com/influxdata/influxdb/v2/http" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - ihttp "github.com/influxdata/influxdb/v2/http" "github.com/influxdata/influxdb/v2/pkg/httpc" ) diff --git a/pkger/http_server_stack.go b/pkger/http_server_stack.go index ddc9364115a..45e08e2ae4b 100644 --- a/pkger/http_server_stack.go +++ b/pkger/http_server_stack.go @@ -7,11 +7,10 @@ import ( "path" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" pctx "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "go.uber.org/zap" ) diff --git a/pkger/http_server_stack_test.go b/pkger/http_server_stack_test.go index c4e99e1e615..12cc054c020 100644 --- a/pkger/http_server_stack_test.go +++ b/pkger/http_server_stack_test.go @@ -5,8 +5,6 @@ import ( "context" "errors" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "io/ioutil" "net/http" "net/http/httptest" @@ -14,6 +12,8 @@ import ( "testing" "time" + "github.com/influxdata/influxdb/v2/kit/platform" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/pkg/testttp" "github.com/influxdata/influxdb/v2/pkger" "github.com/stretchr/testify/assert" diff --git a/pkger/http_server_template.go b/pkger/http_server_template.go index ff8ae262b7a..a15579d0d3c 100644 --- a/pkger/http_server_template.go +++ b/pkger/http_server_template.go @@ -9,13 +9,12 @@ import ( "path" "strings" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" pctx "github.com/influxdata/influxdb/v2/context" ierrors "github.com/influxdata/influxdb/v2/kit/errors" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/pkg/jsonnet" "go.uber.org/zap" diff --git a/pkger/http_server_template_test.go b/pkger/http_server_template_test.go index 2733a211a6b..2a68ad51ba0 100644 --- a/pkger/http_server_template_test.go +++ b/pkger/http_server_template_test.go @@ -5,7 +5,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform" "io" "io/ioutil" "net/http" @@ -16,10 +15,10 @@ import ( "testing" "github.com/go-chi/chi" + "github.com/influxdata/influxdb/v2" pcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" - - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/pkg/testttp" "github.com/influxdata/influxdb/v2/pkger" diff --git a/pkger/models.go b/pkger/models.go index f74b82ad1f1..0651e6edecc 100644 --- a/pkger/models.go +++ b/pkger/models.go @@ -6,10 +6,9 @@ import ( "reflect" "time" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" icheck "github.com/influxdata/influxdb/v2/notification/check" "github.com/influxdata/influxdb/v2/notification/endpoint" ) diff --git a/pkger/parser.go b/pkger/parser.go index 4359fb88d7e..20b447f0208 100644 --- a/pkger/parser.go +++ b/pkger/parser.go @@ -16,11 +16,10 @@ import ( "strings" "time" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/flux/ast" "github.com/influxdata/flux/ast/edit" "github.com/influxdata/flux/parser" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/pkg/jsonnet" "github.com/influxdata/influxdb/v2/task/options" "gopkg.in/yaml.v3" diff --git a/pkger/service_auth.go b/pkger/service_auth.go index 5dcacfd4b7e..61b79730c16 100644 --- a/pkger/service_auth.go +++ b/pkger/service_auth.go @@ -3,9 +3,8 @@ package pkger import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) type AuthAgent interface { diff --git a/pkger/service_logging.go b/pkger/service_logging.go index 9cf5fb765a9..5ecb47a0113 100644 --- a/pkger/service_logging.go +++ b/pkger/service_logging.go @@ -5,7 +5,6 @@ import ( "time" "github.com/influxdata/influxdb/v2/kit/platform" - "go.uber.org/zap" ) diff --git a/pkger/service_metrics.go b/pkger/service_metrics.go index 0b149168bdc..da17c7234e4 100644 --- a/pkger/service_metrics.go +++ b/pkger/service_metrics.go @@ -7,9 +7,8 @@ import ( "strconv" "strings" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/metric" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/prom" "github.com/prometheus/client_golang/prometheus" ) diff --git a/pkger/service_tracing.go b/pkger/service_tracing.go index 481328089fa..82cc9930b9e 100644 --- a/pkger/service_tracing.go +++ b/pkger/service_tracing.go @@ -4,7 +4,6 @@ import ( "context" "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/opentracing/opentracing-go/log" ) diff --git a/pkger/store.go b/pkger/store.go index 6ffc848b257..f39cfe6dc4e 100644 --- a/pkger/store.go +++ b/pkger/store.go @@ -9,7 +9,6 @@ import ( "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2/kv" ) diff --git a/pkger/store_test.go b/pkger/store_test.go index a3cf0344d69..8db2fc882e6 100644 --- a/pkger/store_test.go +++ b/pkger/store_test.go @@ -2,18 +2,17 @@ package pkger_test import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "testing" "time" "github.com/influxdata/influxdb/v2/inmem" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kv/migration/all" - "go.uber.org/zap/zaptest" - "github.com/influxdata/influxdb/v2/pkger" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" ) func TestStoreKV(t *testing.T) { diff --git a/pprof/http_server.go b/pprof/http_server.go index 4c91b7bbb61..f589137e409 100644 --- a/pprof/http_server.go +++ b/pprof/http_server.go @@ -8,9 +8,8 @@ import ( "strconv" "time" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" + "github.com/influxdata/influxdb/v2/kit/platform/errors" ihttp "github.com/influxdata/influxdb/v2/kit/transport/http" ) diff --git a/predicate/logical.go b/predicate/logical.go index 0c526df3ae6..c51c26f78ac 100644 --- a/predicate/logical.go +++ b/predicate/logical.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2/storage/reads/datatypes" ) diff --git a/predicate/parser.go b/predicate/parser.go index d05ab3f4eaf..5a9cd625fe3 100644 --- a/predicate/parser.go +++ b/predicate/parser.go @@ -4,9 +4,8 @@ import ( "fmt" "strings" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxql" ) diff --git a/predicate/parser_test.go b/predicate/parser_test.go index 5577170469c..164f1bec19b 100644 --- a/predicate/parser_test.go +++ b/predicate/parser_test.go @@ -4,10 +4,9 @@ import ( "strings" "testing" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" influxtesting "github.com/influxdata/influxdb/v2/testing" "github.com/influxdata/influxql" ) diff --git a/predicate/tag_rule.go b/predicate/tag_rule.go index 42e06959f92..bc3fc8a0484 100644 --- a/predicate/tag_rule.go +++ b/predicate/tag_rule.go @@ -3,9 +3,8 @@ package predicate import ( "fmt" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxdb/v2/storage/reads/datatypes" ) diff --git a/prometheus/auth_service.go b/prometheus/auth_service.go index d056b408b1c..f529c9f8d02 100644 --- a/prometheus/auth_service.go +++ b/prometheus/auth_service.go @@ -5,9 +5,8 @@ import ( "fmt" "time" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/prometheus/client_golang/prometheus" ) diff --git a/prometheus/auth_service_test.go b/prometheus/auth_service_test.go index f3a522dff90..d4da5bafcd9 100644 --- a/prometheus/auth_service_test.go +++ b/prometheus/auth_service_test.go @@ -3,10 +3,10 @@ package prometheus_test import ( "context" "errors" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" "testing" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/prom" "github.com/influxdata/influxdb/v2/kit/prom/promtest" "github.com/influxdata/influxdb/v2/prometheus" diff --git a/query/bridges.go b/query/bridges.go index f0ce6c093b5..73b9c3cd287 100644 --- a/query/bridges.go +++ b/query/bridges.go @@ -5,12 +5,11 @@ import ( "context" "io" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/flux" "github.com/influxdata/flux/csv" platform "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/check" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/tracing" ) diff --git a/query/control/controller.go b/query/control/controller.go index 3e6578fef2b..8d20af81248 100644 --- a/query/control/controller.go +++ b/query/control/controller.go @@ -24,8 +24,6 @@ import ( "sync" "sync/atomic" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/flux" "github.com/influxdata/flux/codes" "github.com/influxdata/flux/execute/table" @@ -34,6 +32,7 @@ import ( "github.com/influxdata/flux/runtime" "github.com/influxdata/influxdb/v2/kit/errors" "github.com/influxdata/influxdb/v2/kit/feature" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kit/prom" "github.com/influxdata/influxdb/v2/kit/tracing" influxlogger "github.com/influxdata/influxdb/v2/logger" diff --git a/query/dependency.go b/query/dependency.go index 0ef9ebe1f27..566ad7b8a76 100644 --- a/query/dependency.go +++ b/query/dependency.go @@ -3,11 +3,10 @@ package query import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/flux" "github.com/influxdata/flux/codes" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) // FromBucketService wraps an influxdb.BucketService in the BucketLookup interface. diff --git a/query/dependency_test.go b/query/dependency_test.go index ad761a3e0db..7d3c64b561b 100644 --- a/query/dependency_test.go +++ b/query/dependency_test.go @@ -2,9 +2,9 @@ package query_test import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" "testing" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/query" ) diff --git a/query/influxql/end_to_end_test.go b/query/influxql/end_to_end_test.go index f51fa322705..3849bbe6d34 100644 --- a/query/influxql/end_to_end_test.go +++ b/query/influxql/end_to_end_test.go @@ -4,7 +4,6 @@ import ( "bufio" "bytes" "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" "io" "io/ioutil" "os" @@ -19,6 +18,7 @@ import ( fluxquerytest "github.com/influxdata/flux/querytest" platform "github.com/influxdata/influxdb/v2" _ "github.com/influxdata/influxdb/v2/fluxinit/static" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/query" "github.com/influxdata/influxdb/v2/query/influxql" diff --git a/query/influxql/service.go b/query/influxql/service.go index 7ce98f9e0b9..1ed4bfe4cc9 100644 --- a/query/influxql/service.go +++ b/query/influxql/service.go @@ -9,7 +9,6 @@ import ( "net/url" "github.com/influxdata/flux" - "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/query" ) diff --git a/query/influxql/spectests/testing.go b/query/influxql/spectests/testing.go index 77be45c8373..cb26ddd232e 100644 --- a/query/influxql/spectests/testing.go +++ b/query/influxql/spectests/testing.go @@ -7,17 +7,16 @@ import ( "testing" "time" - "github.com/influxdata/flux/ast/astutil" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/stretchr/testify/require" - "github.com/andreyvit/diff" "github.com/influxdata/flux/ast" + "github.com/influxdata/flux/ast/astutil" "github.com/influxdata/flux/parser" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/query/influxql" platformtesting "github.com/influxdata/influxdb/v2/testing" + "github.com/stretchr/testify/require" ) var dbrpMappingSvc = &mock.DBRPMappingService{} diff --git a/query/influxql/transpiler.go b/query/influxql/transpiler.go index 5e617f7d6bb..c7ebdd15044 100644 --- a/query/influxql/transpiler.go +++ b/query/influxql/transpiler.go @@ -8,10 +8,9 @@ import ( "strconv" "time" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/flux/ast" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxql" ) diff --git a/query/influxql/transpiler_test.go b/query/influxql/transpiler_test.go index a584f094dcb..15536320134 100644 --- a/query/influxql/transpiler_test.go +++ b/query/influxql/transpiler_test.go @@ -2,11 +2,11 @@ package influxql_test import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" "strings" "testing" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/query/influxql" "github.com/influxdata/influxdb/v2/query/influxql/spectests" diff --git a/query/logger.go b/query/logger.go index a2f13785cf1..7ec205cf69d 100644 --- a/query/logger.go +++ b/query/logger.go @@ -3,10 +3,9 @@ package query import ( "time" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/flux" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) // Logger persists metadata about executed queries. diff --git a/query/logging_test.go b/query/logging_test.go index 809f9c30d6e..90069653719 100644 --- a/query/logging_test.go +++ b/query/logging_test.go @@ -3,7 +3,6 @@ package query_test import ( "bytes" "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" "io" "io/ioutil" "testing" @@ -13,6 +12,7 @@ import ( "github.com/google/go-cmp/cmp/cmpopts" "github.com/influxdata/flux" "github.com/influxdata/flux/metadata" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/query" "github.com/influxdata/influxdb/v2/query/mock" "github.com/opentracing/opentracing-go" diff --git a/query/request.go b/query/request.go index 30dad9602b7..d9eb8beecfd 100644 --- a/query/request.go +++ b/query/request.go @@ -6,10 +6,9 @@ import ( "fmt" "net/http" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/flux" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) const ( diff --git a/query/stdlib/influxdata/influxdb/buckets.go b/query/stdlib/influxdata/influxdb/buckets.go index b40b31f35eb..14784dec8a5 100644 --- a/query/stdlib/influxdata/influxdb/buckets.go +++ b/query/stdlib/influxdata/influxdb/buckets.go @@ -4,8 +4,6 @@ import ( "context" "fmt" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/flux" "github.com/influxdata/flux/codes" "github.com/influxdata/flux/execute" @@ -14,6 +12,7 @@ import ( "github.com/influxdata/flux/stdlib/influxdata/influxdb" "github.com/influxdata/flux/values" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/query" ) diff --git a/query/stdlib/influxdata/influxdb/metrics.go b/query/stdlib/influxdata/influxdb/metrics.go index 9cbb230e182..e4ea00fef55 100644 --- a/query/stdlib/influxdata/influxdb/metrics.go +++ b/query/stdlib/influxdata/influxdb/metrics.go @@ -6,7 +6,6 @@ import ( "time" platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/prometheus/client_golang/prometheus" ) diff --git a/query/stdlib/influxdata/influxdb/operators.go b/query/stdlib/influxdata/influxdb/operators.go index 1da6587597e..9eaa060ef54 100644 --- a/query/stdlib/influxdata/influxdb/operators.go +++ b/query/stdlib/influxdata/influxdb/operators.go @@ -4,12 +4,11 @@ import ( "context" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/flux" "github.com/influxdata/flux/codes" "github.com/influxdata/flux/plan" "github.com/influxdata/flux/values" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/storage/reads/datatypes" ) diff --git a/query/stdlib/influxdata/influxdb/source.go b/query/stdlib/influxdata/influxdb/source.go index a8189dc4c5f..17405deebeb 100644 --- a/query/stdlib/influxdata/influxdb/source.go +++ b/query/stdlib/influxdata/influxdb/source.go @@ -5,14 +5,13 @@ import ( "errors" "time" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/flux" "github.com/influxdata/flux/codes" "github.com/influxdata/flux/execute" "github.com/influxdata/flux/memory" "github.com/influxdata/flux/metadata" "github.com/influxdata/flux/plan" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/query" "github.com/influxdata/influxdb/v2/tsdb/cursors" diff --git a/query/stdlib/influxdata/influxdb/storage.go b/query/stdlib/influxdata/influxdb/storage.go index d1595cbaf8a..817aca98046 100644 --- a/query/stdlib/influxdata/influxdb/storage.go +++ b/query/stdlib/influxdata/influxdb/storage.go @@ -4,7 +4,6 @@ import ( "context" platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/prom" "github.com/influxdata/influxdb/v2/query" "github.com/pkg/errors" diff --git a/query/stdlib/influxdata/influxdb/v1/databases.go b/query/stdlib/influxdata/influxdb/v1/databases.go index b8aa9c35ecf..bb435891ad2 100644 --- a/query/stdlib/influxdata/influxdb/v1/databases.go +++ b/query/stdlib/influxdata/influxdb/v1/databases.go @@ -5,9 +5,6 @@ import ( "fmt" "time" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/flux" "github.com/influxdata/flux/codes" "github.com/influxdata/flux/execute" @@ -16,6 +13,8 @@ import ( v1 "github.com/influxdata/flux/stdlib/influxdata/influxdb/v1" "github.com/influxdata/flux/values" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/query" "github.com/pkg/errors" ) diff --git a/query/stdlib/testing/end_to_end_test.go b/query/stdlib/testing/end_to_end_test.go index 650a95e8265..3827a867ae0 100644 --- a/query/stdlib/testing/end_to_end_test.go +++ b/query/stdlib/testing/end_to_end_test.go @@ -15,7 +15,6 @@ import ( "github.com/influxdata/flux/parser" "github.com/influxdata/flux/runtime" "github.com/influxdata/flux/stdlib" - platform "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/cmd/influxd/launcher" influxdbcontext "github.com/influxdata/influxdb/v2/context" @@ -25,7 +24,9 @@ import ( "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/query" _ "github.com/influxdata/influxdb/v2/query/stdlib" - itesting "github.com/influxdata/influxdb/v2/query/stdlib/testing" // Import the stdlib + + // Import the stdlib + itesting "github.com/influxdata/influxdb/v2/query/stdlib/testing" ) // Flagger for end-to-end test cases. This flagger contains a pointer to a diff --git a/query/storage.go b/query/storage.go index 58c4d8e1e83..f72e7d50587 100644 --- a/query/storage.go +++ b/query/storage.go @@ -4,12 +4,11 @@ import ( "context" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/flux" "github.com/influxdata/flux/execute" "github.com/influxdata/flux/memory" "github.com/influxdata/flux/plan" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/storage/reads/datatypes" "github.com/influxdata/influxdb/v2/tsdb/cursors" ) diff --git a/resource/resource.go b/resource/resource.go index d207332506b..9a4fb378013 100644 --- a/resource/resource.go +++ b/resource/resource.go @@ -7,9 +7,8 @@ package resource import ( "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) // Logger records changes to resources. diff --git a/secret/http_client.go b/secret/http_client.go index ef3f268b64e..0880e9e4b5b 100644 --- a/secret/http_client.go +++ b/secret/http_client.go @@ -6,7 +6,6 @@ import ( "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/pkg/httpc" ) diff --git a/secret/http_server.go b/secret/http_server.go index bfb081f1aa5..0679e86744a 100644 --- a/secret/http_server.go +++ b/secret/http_server.go @@ -4,11 +4,10 @@ import ( "fmt" "net/http" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "go.uber.org/zap" ) diff --git a/secret/http_server_test.go b/secret/http_server_test.go index e5414fb63a5..fbf9a22c138 100644 --- a/secret/http_server_test.go +++ b/secret/http_server_test.go @@ -10,13 +10,12 @@ import ( "net/http/httptest" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/influxdata/influxdb/v2" influxdbhttp "github.com/influxdata/influxdb/v2/http" "github.com/influxdata/influxdb/v2/inmem" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kv/migration/all" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" diff --git a/secret/middleware_auth.go b/secret/middleware_auth.go index 891314764e4..efafb8190ee 100644 --- a/secret/middleware_auth.go +++ b/secret/middleware_auth.go @@ -3,10 +3,9 @@ package secret import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.SecretService = (*AuthedSvc)(nil) diff --git a/secret/middleware_auth_test.go b/secret/middleware_auth_test.go index 8dcedd98467..e45c2ba01c5 100644 --- a/secret/middleware_auth_test.go +++ b/secret/middleware_auth_test.go @@ -3,13 +3,13 @@ package secret_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "testing" "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/secret" influxdbtesting "github.com/influxdata/influxdb/v2/testing" diff --git a/secret/middleware_logging.go b/secret/middleware_logging.go index 26fe546868e..5c42c90fcec 100644 --- a/secret/middleware_logging.go +++ b/secret/middleware_logging.go @@ -4,9 +4,8 @@ import ( "context" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "go.uber.org/zap" ) diff --git a/secret/middleware_metrics.go b/secret/middleware_metrics.go index 1169a88d497..c510a72f619 100644 --- a/secret/middleware_metrics.go +++ b/secret/middleware_metrics.go @@ -3,10 +3,9 @@ package secret import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/metric" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/prometheus/client_golang/prometheus" ) diff --git a/secret/service.go b/secret/service.go index d92b6f38dba..7407cbd602d 100644 --- a/secret/service.go +++ b/secret/service.go @@ -4,7 +4,6 @@ import ( "context" "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kv" ) diff --git a/secret/storage.go b/secret/storage.go index 656c0677b0f..b46d940cadd 100644 --- a/secret/storage.go +++ b/secret/storage.go @@ -5,10 +5,9 @@ import ( "encoding/base64" "errors" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kv" ) diff --git a/session/http_server.go b/session/http_server.go index 9ae4e88422f..bab678453e4 100644 --- a/session/http_server.go +++ b/session/http_server.go @@ -4,11 +4,10 @@ import ( "context" "net/http" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "go.uber.org/zap" ) diff --git a/session/http_server_test.go b/session/http_server_test.go index 3274501f4a5..59ce6551b7d 100644 --- a/session/http_server_test.go +++ b/session/http_server_test.go @@ -7,9 +7,8 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" "go.uber.org/zap/zaptest" ) diff --git a/session/service.go b/session/service.go index afcaa63039e..0b734d842cc 100644 --- a/session/service.go +++ b/session/service.go @@ -4,10 +4,9 @@ import ( "context" "time" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/rand" "github.com/influxdata/influxdb/v2/snowflake" ) diff --git a/session/storage.go b/session/storage.go index b585f9ab2f5..958a5a265b6 100644 --- a/session/storage.go +++ b/session/storage.go @@ -5,10 +5,9 @@ import ( "encoding/json" "time" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" ) type Store interface { diff --git a/snowflake/id.go b/snowflake/id.go index a3764b5d23b..13eb8b42976 100644 --- a/snowflake/id.go +++ b/snowflake/id.go @@ -7,7 +7,6 @@ import ( "time" platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/pkg/snowflake" ) diff --git a/sqlite/sqlite.go b/sqlite/sqlite.go index 19b16793d13..c621e0802d3 100644 --- a/sqlite/sqlite.go +++ b/sqlite/sqlite.go @@ -16,7 +16,6 @@ import ( sqliteMigrations "github.com/influxdata/influxdb/v2/sqlite/migrations" "github.com/jmoiron/sqlx" "github.com/mattn/go-sqlite3" - "go.uber.org/zap" ) diff --git a/storage/bucket_service.go b/storage/bucket_service.go index 4f2852b5058..2c4b6a65739 100644 --- a/storage/bucket_service.go +++ b/storage/bucket_service.go @@ -3,9 +3,8 @@ package storage import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/v1/services/meta" "go.uber.org/zap" diff --git a/storage/bucket_service_test.go b/storage/bucket_service_test.go index 245bbe6f219..c19c1f600e5 100644 --- a/storage/bucket_service_test.go +++ b/storage/bucket_service_test.go @@ -2,7 +2,6 @@ package storage_test import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" "testing" "time" @@ -10,6 +9,7 @@ import ( "github.com/golang/mock/gomock" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/inmem" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv/migration/all" "github.com/influxdata/influxdb/v2/storage" "github.com/influxdata/influxdb/v2/storage/mocks" diff --git a/storage/engine.go b/storage/engine.go index fff0c0456d1..7977c849532 100644 --- a/storage/engine.go +++ b/storage/engine.go @@ -8,11 +8,10 @@ import ( "sync" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/influxql/query" + "github.com/influxdata/influxdb/v2/kit/platform" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxdb/v2/tsdb" diff --git a/storage/flux/reader.go b/storage/flux/reader.go index 1a702d87eec..fee77a470d5 100644 --- a/storage/flux/reader.go +++ b/storage/flux/reader.go @@ -5,8 +5,6 @@ import ( "fmt" "strings" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/gogo/protobuf/types" "github.com/influxdata/flux" "github.com/influxdata/flux/execute" @@ -14,6 +12,7 @@ import ( "github.com/influxdata/flux/memory" "github.com/influxdata/flux/plan" "github.com/influxdata/flux/values" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxdb/v2/query" storage "github.com/influxdata/influxdb/v2/storage/reads" diff --git a/storage/mocks/EngineSchema.go b/storage/mocks/EngineSchema.go index d242166d8e9..8778114f0f4 100644 --- a/storage/mocks/EngineSchema.go +++ b/storage/mocks/EngineSchema.go @@ -6,11 +6,11 @@ package mocks import ( context "context" - "github.com/influxdata/influxdb/v2/kit/platform" reflect "reflect" gomock "github.com/golang/mock/gomock" influxdb "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) // MockEngineSchema is a mock of EngineSchema interface. diff --git a/storage/points_writer.go b/storage/points_writer.go index 85e30bb015e..81a868aabeb 100644 --- a/storage/points_writer.go +++ b/storage/points_writer.go @@ -5,9 +5,8 @@ import ( "fmt" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/models" ) diff --git a/tag_test.go b/tag_test.go index 40f1e33cce6..919331405d1 100644 --- a/tag_test.go +++ b/tag_test.go @@ -1,10 +1,10 @@ package influxdb_test import ( - "github.com/influxdata/influxdb/v2/kit/platform/errors" "testing" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" influxTesting "github.com/influxdata/influxdb/v2/testing" ) diff --git a/task/backend/executor/mock/permission_service.go b/task/backend/executor/mock/permission_service.go index 812fe70491e..a904c0f97bf 100644 --- a/task/backend/executor/mock/permission_service.go +++ b/task/backend/executor/mock/permission_service.go @@ -6,10 +6,11 @@ package mock import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" influxdb "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" - reflect "reflect" ) // MockPermissionService is a mock of PermissionService interface diff --git a/task/backend/executor/support_test.go b/task/backend/executor/support_test.go index 98be9f21a0e..206cdfc1373 100644 --- a/task/backend/executor/support_test.go +++ b/task/backend/executor/support_test.go @@ -8,8 +8,6 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/flux" "github.com/influxdata/flux/execute" "github.com/influxdata/flux/lang" @@ -18,6 +16,7 @@ import ( "github.com/influxdata/flux/values" "github.com/influxdata/influxdb/v2" _ "github.com/influxdata/influxdb/v2/fluxinit/static" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/query" ) diff --git a/task/backend/scheduler/scheduler_test.go b/task/backend/scheduler/scheduler_test.go index 32efa56b3e1..f2bab62a93b 100644 --- a/task/backend/scheduler/scheduler_test.go +++ b/task/backend/scheduler/scheduler_test.go @@ -7,9 +7,8 @@ import ( "testing" "time" - "github.com/influxdata/cron" - "github.com/benbjohnson/clock" + "github.com/influxdata/cron" ) type mockExecutor struct { diff --git a/telegraf.go b/telegraf.go index d5f943e790b..fb68529b160 100644 --- a/telegraf.go +++ b/telegraf.go @@ -6,10 +6,9 @@ import ( "fmt" "regexp" + "github.com/BurntSushi/toml" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/BurntSushi/toml" "github.com/influxdata/influxdb/v2/telegraf/plugins" "github.com/influxdata/influxdb/v2/telegraf/plugins/inputs" "github.com/influxdata/influxdb/v2/telegraf/plugins/outputs" diff --git a/telegraf/service/telegraf.go b/telegraf/service/telegraf.go index 31a043fe3d9..0841541f0d3 100644 --- a/telegraf/service/telegraf.go +++ b/telegraf/service/telegraf.go @@ -5,10 +5,9 @@ import ( "encoding/json" "fmt" + influxdb "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - influxdb "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/snowflake" "github.com/influxdata/influxdb/v2/telegraf" diff --git a/telegraf/service/testing/testing.go b/telegraf/service/testing/testing.go index 2414bfec323..60ea761eab8 100644 --- a/telegraf/service/testing/testing.go +++ b/telegraf/service/testing/testing.go @@ -6,12 +6,11 @@ import ( "sort" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" influxdb "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/telegraf/plugins/inputs" "github.com/influxdata/influxdb/v2/telegraf/plugins/outputs" diff --git a/telegraf_test.go b/telegraf_test.go index 76f2158442f..0b7cc5d1296 100644 --- a/telegraf_test.go +++ b/telegraf_test.go @@ -6,11 +6,10 @@ import ( "sort" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/telegraf/plugins" "github.com/influxdata/influxdb/v2/telegraf/plugins/inputs" "github.com/influxdata/influxdb/v2/telegraf/plugins/outputs" diff --git a/telemetry/handler.go b/telemetry/handler.go index fc728034547..e4f14697573 100644 --- a/telemetry/handler.go +++ b/telemetry/handler.go @@ -7,11 +7,10 @@ import ( "net/http" "time" - "go.uber.org/zap" - "github.com/influxdata/influxdb/v2/prometheus" dto "github.com/prometheus/client_model/go" "github.com/prometheus/common/expfmt" + "go.uber.org/zap" ) const ( diff --git a/tenant/error_org.go b/tenant/error_org.go index b80240a08b1..3fab66b09db 100644 --- a/tenant/error_org.go +++ b/tenant/error_org.go @@ -3,9 +3,8 @@ package tenant import ( "fmt" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform/errors" ) var ( diff --git a/tenant/http_client_bucket.go b/tenant/http_client_bucket.go index 39d22c0362e..bca3e65137e 100644 --- a/tenant/http_client_bucket.go +++ b/tenant/http_client_bucket.go @@ -5,10 +5,9 @@ import ( "fmt" "path" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/pkg/httpc" ) diff --git a/tenant/http_client_org.go b/tenant/http_client_org.go index 722c7e82478..846aa5ec6fc 100644 --- a/tenant/http_client_org.go +++ b/tenant/http_client_org.go @@ -3,10 +3,9 @@ package tenant import ( "context" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/pkg/httpc" ) diff --git a/tenant/http_client_urm.go b/tenant/http_client_urm.go index 3b094d45b53..679972e1934 100644 --- a/tenant/http_client_urm.go +++ b/tenant/http_client_urm.go @@ -4,9 +4,8 @@ import ( "context" "path" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/pkg/httpc" ) diff --git a/tenant/http_client_user.go b/tenant/http_client_user.go index ceb5caa0068..0fe2bca6b73 100644 --- a/tenant/http_client_user.go +++ b/tenant/http_client_user.go @@ -4,10 +4,9 @@ import ( "context" "net/http" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" khttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/pkg/httpc" ) diff --git a/tenant/http_handler_urm.go b/tenant/http_handler_urm.go index efb1b4666cb..d43ff5c82a1 100644 --- a/tenant/http_handler_urm.go +++ b/tenant/http_handler_urm.go @@ -7,11 +7,10 @@ import ( "net/http" "path" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "go.uber.org/zap" ) diff --git a/tenant/http_handler_urm_test.go b/tenant/http_handler_urm_test.go index 0af3f1e3dfb..bcc9d38e4ac 100644 --- a/tenant/http_handler_urm_test.go +++ b/tenant/http_handler_urm_test.go @@ -5,7 +5,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/influxdata/influxdb/v2/kit/platform" "io/ioutil" "net/http" "net/http/httptest" @@ -15,6 +14,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" ihttp "github.com/influxdata/influxdb/v2/http" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/tenant" itesting "github.com/influxdata/influxdb/v2/testing" diff --git a/tenant/http_server_bucket.go b/tenant/http_server_bucket.go index ff081405161..960410c2d42 100644 --- a/tenant/http_server_bucket.go +++ b/tenant/http_server_bucket.go @@ -6,12 +6,11 @@ import ( "net/http" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "go.uber.org/zap" ) diff --git a/tenant/http_server_org.go b/tenant/http_server_org.go index cb83d422069..20cfeed259f 100644 --- a/tenant/http_server_org.go +++ b/tenant/http_server_org.go @@ -5,11 +5,10 @@ import ( "fmt" "net/http" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "go.uber.org/zap" ) diff --git a/tenant/http_server_user.go b/tenant/http_server_user.go index b90708b2286..48e279f5d00 100644 --- a/tenant/http_server_user.go +++ b/tenant/http_server_user.go @@ -7,13 +7,12 @@ import ( "net/http" "strings" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/influxdata/influxdb/v2" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "go.uber.org/zap" ) diff --git a/tenant/middleware_bucket_auth.go b/tenant/middleware_bucket_auth.go index 08cc89f5075..4fbffa7d19e 100644 --- a/tenant/middleware_bucket_auth.go +++ b/tenant/middleware_bucket_auth.go @@ -3,10 +3,9 @@ package tenant import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/tracing" ) diff --git a/tenant/middleware_bucket_auth_test.go b/tenant/middleware_bucket_auth_test.go index 9fce1863d74..2f7ed918d99 100644 --- a/tenant/middleware_bucket_auth_test.go +++ b/tenant/middleware_bucket_auth_test.go @@ -3,14 +3,14 @@ package tenant_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/tenant" influxdbtesting "github.com/influxdata/influxdb/v2/testing" diff --git a/tenant/middleware_bucket_logging.go b/tenant/middleware_bucket_logging.go index 2cb561bba6f..ea4a057f564 100644 --- a/tenant/middleware_bucket_logging.go +++ b/tenant/middleware_bucket_logging.go @@ -5,9 +5,8 @@ import ( "fmt" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "go.uber.org/zap" ) diff --git a/tenant/middleware_bucket_metrics.go b/tenant/middleware_bucket_metrics.go index 55888f44deb..0e1c77b0e8f 100644 --- a/tenant/middleware_bucket_metrics.go +++ b/tenant/middleware_bucket_metrics.go @@ -3,10 +3,9 @@ package tenant import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/metric" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/prometheus/client_golang/prometheus" ) diff --git a/tenant/middleware_org_auth.go b/tenant/middleware_org_auth.go index 99b50e5a645..ce9a33befbb 100644 --- a/tenant/middleware_org_auth.go +++ b/tenant/middleware_org_auth.go @@ -3,11 +3,10 @@ package tenant import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.OrganizationService = (*AuthedOrgService)(nil) diff --git a/tenant/middleware_org_auth_test.go b/tenant/middleware_org_auth_test.go index 8ef2a302509..5907c6b8f03 100644 --- a/tenant/middleware_org_auth_test.go +++ b/tenant/middleware_org_auth_test.go @@ -3,14 +3,14 @@ package tenant_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" influxdbcontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/tenant" influxdbtesting "github.com/influxdata/influxdb/v2/testing" diff --git a/tenant/middleware_org_logging.go b/tenant/middleware_org_logging.go index cf88d257669..d28d55782a4 100644 --- a/tenant/middleware_org_logging.go +++ b/tenant/middleware_org_logging.go @@ -5,9 +5,8 @@ import ( "fmt" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "go.uber.org/zap" ) diff --git a/tenant/middleware_org_metrics.go b/tenant/middleware_org_metrics.go index 87d72c5aca2..15bf8b9eada 100644 --- a/tenant/middleware_org_metrics.go +++ b/tenant/middleware_org_metrics.go @@ -3,10 +3,9 @@ package tenant import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/metric" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/prometheus/client_golang/prometheus" ) diff --git a/tenant/middleware_urm_auth.go b/tenant/middleware_urm_auth.go index fb038be06e6..5a9be361670 100644 --- a/tenant/middleware_urm_auth.go +++ b/tenant/middleware_urm_auth.go @@ -3,10 +3,9 @@ package tenant import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" + "github.com/influxdata/influxdb/v2/kit/platform" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" ) diff --git a/tenant/middleware_urm_auth_test.go b/tenant/middleware_urm_auth_test.go index c2ea35bc1be..5e51e089d66 100644 --- a/tenant/middleware_urm_auth_test.go +++ b/tenant/middleware_urm_auth_test.go @@ -4,13 +4,12 @@ import ( "context" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" influxdbcontext "github.com/influxdata/influxdb/v2/context" "github.com/influxdata/influxdb/v2/kit/feature" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" diff --git a/tenant/middleware_urm_logging.go b/tenant/middleware_urm_logging.go index e9022e8726b..4a657f8cf0a 100644 --- a/tenant/middleware_urm_logging.go +++ b/tenant/middleware_urm_logging.go @@ -5,9 +5,8 @@ import ( "fmt" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "go.uber.org/zap" ) diff --git a/tenant/middleware_urm_metrics.go b/tenant/middleware_urm_metrics.go index ad25923fdca..8906fd66376 100644 --- a/tenant/middleware_urm_metrics.go +++ b/tenant/middleware_urm_metrics.go @@ -3,10 +3,9 @@ package tenant import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/metric" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/prometheus/client_golang/prometheus" ) diff --git a/tenant/middleware_user_auth.go b/tenant/middleware_user_auth.go index debc60ba5e0..2f7c7cc83de 100644 --- a/tenant/middleware_user_auth.go +++ b/tenant/middleware_user_auth.go @@ -3,10 +3,9 @@ package tenant import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" + "github.com/influxdata/influxdb/v2/kit/platform" ) var _ influxdb.UserService = (*AuthedUserService)(nil) diff --git a/tenant/middleware_user_auth_test.go b/tenant/middleware_user_auth_test.go index fbc7c168253..8d71b8f3157 100644 --- a/tenant/middleware_user_auth_test.go +++ b/tenant/middleware_user_auth_test.go @@ -3,8 +3,6 @@ package tenant_test import ( "bytes" "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "sort" "testing" @@ -12,6 +10,8 @@ import ( "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/tenant" influxdbtesting "github.com/influxdata/influxdb/v2/testing" diff --git a/tenant/middleware_user_logging.go b/tenant/middleware_user_logging.go index 5a1a755578b..4d973505d7c 100644 --- a/tenant/middleware_user_logging.go +++ b/tenant/middleware_user_logging.go @@ -5,9 +5,8 @@ import ( "fmt" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "go.uber.org/zap" ) diff --git a/tenant/middleware_user_metrics.go b/tenant/middleware_user_metrics.go index a2753fc17af..b03093becb3 100644 --- a/tenant/middleware_user_metrics.go +++ b/tenant/middleware_user_metrics.go @@ -3,10 +3,9 @@ package tenant import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/metric" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/prometheus/client_golang/prometheus" ) diff --git a/tenant/service_bucket.go b/tenant/service_bucket.go index 6d1a49dfb62..461ffee7f33 100644 --- a/tenant/service_bucket.go +++ b/tenant/service_bucket.go @@ -5,10 +5,9 @@ import ( "fmt" "strings" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kv" ) diff --git a/tenant/service_onboarding.go b/tenant/service_onboarding.go index 18988c50150..bc486622953 100644 --- a/tenant/service_onboarding.go +++ b/tenant/service_onboarding.go @@ -5,11 +5,10 @@ import ( "fmt" "strings" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kv" "go.uber.org/zap" ) diff --git a/tenant/service_onboarding_test.go b/tenant/service_onboarding_test.go index 7018d17718c..2aff3725a47 100644 --- a/tenant/service_onboarding_test.go +++ b/tenant/service_onboarding_test.go @@ -5,17 +5,15 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/pkg/testing/assert" - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/require" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorization" icontext "github.com/influxdata/influxdb/v2/context" "github.com/influxdata/influxdb/v2/kv" + "github.com/influxdata/influxdb/v2/pkg/testing/assert" "github.com/influxdata/influxdb/v2/tenant" influxdbtesting "github.com/influxdata/influxdb/v2/testing" + "github.com/stretchr/testify/require" ) func TestBoltOnboardingService(t *testing.T) { diff --git a/tenant/service_op_log.go b/tenant/service_op_log.go index 41369f574d0..7452caf5753 100644 --- a/tenant/service_op_log.go +++ b/tenant/service_op_log.go @@ -5,9 +5,8 @@ import ( "encoding/json" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv" ) diff --git a/tenant/service_org.go b/tenant/service_org.go index e45f94abf5a..10b5558fe65 100644 --- a/tenant/service_org.go +++ b/tenant/service_org.go @@ -3,10 +3,9 @@ package tenant import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv" ) diff --git a/tenant/service_urm.go b/tenant/service_urm.go index 70683fcf6cf..586f5d04633 100644 --- a/tenant/service_urm.go +++ b/tenant/service_urm.go @@ -3,9 +3,8 @@ package tenant import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv" ) diff --git a/tenant/service_user.go b/tenant/service_user.go index 4728c73ac64..3236d8ca6e7 100644 --- a/tenant/service_user.go +++ b/tenant/service_user.go @@ -3,10 +3,9 @@ package tenant import ( "context" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kv" "golang.org/x/crypto/bcrypt" ) diff --git a/tenant/storage.go b/tenant/storage.go index 371f9d73997..8f989826fcd 100644 --- a/tenant/storage.go +++ b/tenant/storage.go @@ -6,7 +6,6 @@ import ( "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/rand" diff --git a/tenant/storage_bucket.go b/tenant/storage_bucket.go index 1502e3b7cf8..8a0c28d162f 100644 --- a/tenant/storage_bucket.go +++ b/tenant/storage_bucket.go @@ -4,10 +4,9 @@ import ( "context" "encoding/json" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kv" ) diff --git a/tenant/storage_org.go b/tenant/storage_org.go index 391d0e99312..2dea53a4345 100644 --- a/tenant/storage_org.go +++ b/tenant/storage_org.go @@ -5,9 +5,8 @@ import ( "encoding/json" "strings" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv" ) diff --git a/tenant/storage_urm.go b/tenant/storage_urm.go index 79e4b0cb31e..1d5195d7dc5 100644 --- a/tenant/storage_urm.go +++ b/tenant/storage_urm.go @@ -4,9 +4,8 @@ import ( "context" "encoding/json" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv" ) diff --git a/tenant/storage_user.go b/tenant/storage_user.go index 8d261afb33c..0fdc2da2225 100644 --- a/tenant/storage_user.go +++ b/tenant/storage_user.go @@ -4,9 +4,8 @@ import ( "context" "encoding/json" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv" ) diff --git a/testing/auth.go b/testing/auth.go index e96247bb0ed..35e1aec7fb8 100644 --- a/testing/auth.go +++ b/testing/auth.go @@ -7,12 +7,11 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" ) diff --git a/testing/bucket_service.go b/testing/bucket_service.go index 02bf10865da..cd81bb0cb78 100644 --- a/testing/bucket_service.go +++ b/testing/bucket_service.go @@ -7,12 +7,11 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/dustin/go-humanize" "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" ) diff --git a/testing/dbrp_mapping.go b/testing/dbrp_mapping.go index 7e7f3c9f0ab..5a552b1024f 100644 --- a/testing/dbrp_mapping.go +++ b/testing/dbrp_mapping.go @@ -7,12 +7,11 @@ import ( "sort" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/dbrp" + "github.com/influxdata/influxdb/v2/kit/platform" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/pkg/errors" ) diff --git a/testing/label_service.go b/testing/label_service.go index ca91c964d34..cd09988ee1e 100644 --- a/testing/label_service.go +++ b/testing/label_service.go @@ -6,11 +6,10 @@ import ( "sort" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" ) diff --git a/testing/migration.go b/testing/migration.go index 66e3be4768d..2909b0ac3fb 100644 --- a/testing/migration.go +++ b/testing/migration.go @@ -8,7 +8,6 @@ import ( "time" "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/kv/migration" "go.uber.org/zap" diff --git a/testing/onboarding.go b/testing/onboarding.go index 12bccce4ad2..03f473ed830 100644 --- a/testing/onboarding.go +++ b/testing/onboarding.go @@ -5,11 +5,10 @@ import ( "testing" "time" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" ) diff --git a/testing/organization_service.go b/testing/organization_service.go index 4342ce5cbed..e61f1400520 100644 --- a/testing/organization_service.go +++ b/testing/organization_service.go @@ -7,11 +7,10 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" ) diff --git a/testing/passwords.go b/testing/passwords.go index 45871372a07..e40894182b1 100644 --- a/testing/passwords.go +++ b/testing/passwords.go @@ -5,9 +5,8 @@ import ( "fmt" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) // PasswordFields will include the IDGenerator, and users and their passwords. diff --git a/testing/scraper_target.go b/testing/scraper_target.go index c97fc04296e..20a4a837ff3 100644 --- a/testing/scraper_target.go +++ b/testing/scraper_target.go @@ -7,11 +7,10 @@ import ( "sort" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" ) diff --git a/testing/secret.go b/testing/secret.go index 5e071e50cf0..88a3878a93f 100644 --- a/testing/secret.go +++ b/testing/secret.go @@ -6,11 +6,10 @@ import ( "sort" "testing" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" ) var secretCmpOptions = cmp.Options{ diff --git a/testing/session.go b/testing/session.go index b40f3bbd26b..19631b6e249 100644 --- a/testing/session.go +++ b/testing/session.go @@ -7,12 +7,11 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" ) diff --git a/testing/source.go b/testing/source.go index 6605ccd204f..c81a3c13dc3 100644 --- a/testing/source.go +++ b/testing/source.go @@ -6,11 +6,10 @@ import ( "sort" "testing" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" ) diff --git a/testing/user_resource_mapping_service.go b/testing/user_resource_mapping_service.go index f5c0dfd0005..ced8256dea5 100644 --- a/testing/user_resource_mapping_service.go +++ b/testing/user_resource_mapping_service.go @@ -7,10 +7,9 @@ import ( "sort" "testing" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/google/go-cmp/cmp" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) var mappingCmpOptions = cmp.Options{ diff --git a/testing/user_service.go b/testing/user_service.go index 0de1eb6c855..e684fdb5411 100644 --- a/testing/user_service.go +++ b/testing/user_service.go @@ -6,11 +6,10 @@ import ( "sort" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" ) diff --git a/testing/variable.go b/testing/variable.go index 50b79048108..34325f2855f 100644 --- a/testing/variable.go +++ b/testing/variable.go @@ -8,11 +8,10 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/pkg/testing/assert" "github.com/stretchr/testify/require" diff --git a/tests/client.go b/tests/client.go index f419c2262a1..26f1e721d91 100644 --- a/tests/client.go +++ b/tests/client.go @@ -9,12 +9,11 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/flux/csv" "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorization" influxhttp "github.com/influxdata/influxdb/v2/http" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/pkg/httpc" "github.com/influxdata/influxdb/v2/tenant" ) diff --git a/tests/mock.go b/tests/mock.go index 450abe7e2dc..c3b4b772528 100644 --- a/tests/mock.go +++ b/tests/mock.go @@ -4,10 +4,9 @@ import ( "net/http" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" influxhttp "github.com/influxdata/influxdb/v2/http" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/notification" checks "github.com/influxdata/influxdb/v2/notification/check" "github.com/influxdata/influxdb/v2/notification/endpoint" diff --git a/tests/pipeline/fixture.go b/tests/pipeline/fixture.go index bdcf3f5b7e9..1e07ccaa40f 100644 --- a/tests/pipeline/fixture.go +++ b/tests/pipeline/fixture.go @@ -4,9 +4,8 @@ import ( "fmt" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/tests" ) diff --git a/tests/pipeline_helpers.go b/tests/pipeline_helpers.go index 4b2ac735219..aa0440090d1 100644 --- a/tests/pipeline_helpers.go +++ b/tests/pipeline_helpers.go @@ -4,10 +4,9 @@ import ( "context" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/cmd/influxd/launcher" + "github.com/influxdata/influxdb/v2/kit/platform" "go.uber.org/zap" ) diff --git a/tsdb/cursors/mock/cursor_iterator.go b/tsdb/cursors/mock/cursor_iterator.go index e0be8cbb88f..4084125f6ce 100644 --- a/tsdb/cursors/mock/cursor_iterator.go +++ b/tsdb/cursors/mock/cursor_iterator.go @@ -6,9 +6,10 @@ package mock import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" cursors "github.com/influxdata/influxdb/v2/tsdb/cursors" - reflect "reflect" ) // MockCursorIterator is a mock of CursorIterator interface diff --git a/tsdb/cursors/mock/integer_array_cursor.go b/tsdb/cursors/mock/integer_array_cursor.go index 83dfcbb97c6..5b0a00dcca7 100644 --- a/tsdb/cursors/mock/integer_array_cursor.go +++ b/tsdb/cursors/mock/integer_array_cursor.go @@ -5,9 +5,10 @@ package mock import ( + reflect "reflect" + gomock "github.com/golang/mock/gomock" cursors "github.com/influxdata/influxdb/v2/tsdb/cursors" - reflect "reflect" ) // MockIntegerArrayCursor is a mock of IntegerArrayCursor interface diff --git a/tsdb/engine/engine.go b/tsdb/engine/engine.go index 291b6e1f1ad..8b5870da803 100644 --- a/tsdb/engine/engine.go +++ b/tsdb/engine/engine.go @@ -4,6 +4,7 @@ package engine // import "github.com/influxdata/influxdb/v2/tsdb/engine" import ( + // Initialize and register tsm1 engine _ "github.com/influxdata/influxdb/v2/tsdb/engine/tsm1" ) diff --git a/tsdb/engine/tsm1/reader_test.go b/tsdb/engine/tsm1/reader_test.go index b842e6af2ca..c3260f31768 100644 --- a/tsdb/engine/tsm1/reader_test.go +++ b/tsdb/engine/tsm1/reader_test.go @@ -1931,11 +1931,11 @@ func createTestTSM(t *testing.T) (dir string, name string) { }() var data = map[string][]Value{ - "float": []Value{NewValue(1, 1.0)}, - "int": []Value{NewValue(1, int64(1))}, - "uint": []Value{NewValue(1, ^uint64(0))}, - "bool": []Value{NewValue(1, true)}, - "string": []Value{NewValue(1, "foo")}, + "float": {NewValue(1, 1.0)}, + "int": {NewValue(1, int64(1))}, + "uint": {NewValue(1, ^uint64(0))}, + "bool": {NewValue(1, true)}, + "string": {NewValue(1, "foo")}, } keys := make([]string, 0, len(data)) diff --git a/tsdb/index/tsi1/log_file_test.go b/tsdb/index/tsi1/log_file_test.go index 8379226b0b5..e2b0007ebb9 100644 --- a/tsdb/index/tsi1/log_file_test.go +++ b/tsdb/index/tsi1/log_file_test.go @@ -14,13 +14,12 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/pkg/slices" - "github.com/stretchr/testify/require" - "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxdb/v2/pkg/bloom" + "github.com/influxdata/influxdb/v2/pkg/slices" "github.com/influxdata/influxdb/v2/tsdb" "github.com/influxdata/influxdb/v2/tsdb/index/tsi1" + "github.com/stretchr/testify/require" ) // Ensure log file can append series. diff --git a/tsdb/shard_test.go b/tsdb/shard_test.go index adfbd503311..64038ee1926 100644 --- a/tsdb/shard_test.go +++ b/tsdb/shard_test.go @@ -17,12 +17,11 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/internal" - "github.com/davecgh/go-spew/spew" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/influxdata/influxdb/v2/influxql/query" + "github.com/influxdata/influxdb/v2/internal" "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxdb/v2/pkg/deep" "github.com/influxdata/influxdb/v2/tsdb" diff --git a/tsdb/store.go b/tsdb/store.go index 2dc9a42bd49..1fab91ce5ed 100644 --- a/tsdb/store.go +++ b/tsdb/store.go @@ -17,10 +17,9 @@ import ( "sync" "time" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/influxql/query" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/logger" "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxdb/v2/pkg/estimator" diff --git a/user_resource_mapping_test.go b/user_resource_mapping_test.go index 7ef6218f312..35448ba05e4 100644 --- a/user_resource_mapping_test.go +++ b/user_resource_mapping_test.go @@ -1,10 +1,10 @@ package influxdb_test import ( - "github.com/influxdata/influxdb/v2/kit/platform" "testing" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" influxdbtesting "github.com/influxdata/influxdb/v2/testing" "github.com/stretchr/testify/require" ) diff --git a/v1/authorization/authorizer.go b/v1/authorization/authorizer.go index 058771f0431..ec7e4364efa 100644 --- a/v1/authorization/authorizer.go +++ b/v1/authorization/authorizer.go @@ -4,10 +4,9 @@ import ( "context" "errors" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" ) var ( diff --git a/v1/authorization/caching_password_service.go b/v1/authorization/caching_password_service.go index f825c7fda35..e164339ca4e 100644 --- a/v1/authorization/caching_password_service.go +++ b/v1/authorization/caching_password_service.go @@ -8,9 +8,8 @@ import ( "io" "sync" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) // An implementation of influxdb.PasswordsService that will perform diff --git a/v1/authorization/caching_password_service_test.go b/v1/authorization/caching_password_service_test.go index acd6ccb9394..e9405c2cafe 100644 --- a/v1/authorization/caching_password_service_test.go +++ b/v1/authorization/caching_password_service_test.go @@ -5,9 +5,8 @@ import ( "strings" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/golang/mock/gomock" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/mock" "github.com/influxdata/influxdb/v2/tenant" "github.com/stretchr/testify/assert" diff --git a/v1/authorization/http_client.go b/v1/authorization/http_client.go index 62a6a6d9d9a..1c8c86afca3 100644 --- a/v1/authorization/http_client.go +++ b/v1/authorization/http_client.go @@ -4,9 +4,8 @@ import ( "context" "errors" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/pkg/httpc" ) diff --git a/v1/authorization/http_server.go b/v1/authorization/http_server.go index 19914e9e4bc..41996f3cfc5 100644 --- a/v1/authorization/http_server.go +++ b/v1/authorization/http_server.go @@ -7,13 +7,12 @@ import ( "net/http" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/influxdata/influxdb/v2" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "go.uber.org/zap" ) diff --git a/v1/authorization/http_server_test.go b/v1/authorization/http_server_test.go index c01e119a0b2..3bcdde482fb 100644 --- a/v1/authorization/http_server_test.go +++ b/v1/authorization/http_server_test.go @@ -11,15 +11,14 @@ import ( "sort" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/go-chi/chi" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/influxdata/httprouter" "github.com/influxdata/influxdb/v2" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/mock" itesting "github.com/influxdata/influxdb/v2/testing" "go.uber.org/zap/zaptest" diff --git a/v1/authorization/middleware_auth_password_service.go b/v1/authorization/middleware_auth_password_service.go index 961e89d294b..eb1e8385bb8 100644 --- a/v1/authorization/middleware_auth_password_service.go +++ b/v1/authorization/middleware_auth_password_service.go @@ -3,10 +3,9 @@ package authorization import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" + "github.com/influxdata/influxdb/v2/kit/platform" ) type AuthFinder interface { diff --git a/v1/authorization/middleware_auth_password_service_test.go b/v1/authorization/middleware_auth_password_service_test.go index ca187f86e05..6b47ae4dbf3 100644 --- a/v1/authorization/middleware_auth_password_service_test.go +++ b/v1/authorization/middleware_auth_password_service_test.go @@ -2,12 +2,12 @@ package authorization_test import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform/errors" "testing" "github.com/golang/mock/gomock" "github.com/influxdata/influxdb/v2" icontext "github.com/influxdata/influxdb/v2/context" + "github.com/influxdata/influxdb/v2/kit/platform/errors" itest "github.com/influxdata/influxdb/v2/testing" "github.com/influxdata/influxdb/v2/v1/authorization" "github.com/influxdata/influxdb/v2/v1/authorization/mocks" diff --git a/v1/authorization/mock_tenant.go b/v1/authorization/mock_tenant.go index 0b047f8e6f8..42c084b25ab 100644 --- a/v1/authorization/mock_tenant.go +++ b/v1/authorization/mock_tenant.go @@ -3,9 +3,8 @@ package authorization import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" ) // tenantService is a mock implementation of an authorization.tenantService diff --git a/v1/authorization/mocks/auth_finder.go b/v1/authorization/mocks/auth_finder.go index 80733678e3d..c5f832882ec 100644 --- a/v1/authorization/mocks/auth_finder.go +++ b/v1/authorization/mocks/auth_finder.go @@ -6,10 +6,11 @@ package mocks import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" influxdb "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" - reflect "reflect" ) // MockAuthFinder is a mock of AuthFinder interface diff --git a/v1/authorization/mocks/auth_token_finder.go b/v1/authorization/mocks/auth_token_finder.go index 4492d227777..4c734161a39 100644 --- a/v1/authorization/mocks/auth_token_finder.go +++ b/v1/authorization/mocks/auth_token_finder.go @@ -6,9 +6,10 @@ package mocks import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" influxdb "github.com/influxdata/influxdb/v2" - reflect "reflect" ) // MockAuthTokenFinder is a mock of AuthTokenFinder interface diff --git a/v1/authorization/mocks/password_comparer.go b/v1/authorization/mocks/password_comparer.go index 74d632472aa..e7e5f22f0fd 100644 --- a/v1/authorization/mocks/password_comparer.go +++ b/v1/authorization/mocks/password_comparer.go @@ -6,9 +6,10 @@ package mocks import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" "github.com/influxdata/influxdb/v2/kit/platform" - reflect "reflect" ) // MockPasswordComparer is a mock of PasswordComparer interface diff --git a/v1/authorization/mocks/password_service.go b/v1/authorization/mocks/password_service.go index 0a5de62112d..5f562e7cf69 100644 --- a/v1/authorization/mocks/password_service.go +++ b/v1/authorization/mocks/password_service.go @@ -6,9 +6,10 @@ package mocks import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" "github.com/influxdata/influxdb/v2/kit/platform" - reflect "reflect" ) // MockPasswordService is a mock of PasswordService interface diff --git a/v1/authorization/mocks/user_finder.go b/v1/authorization/mocks/user_finder.go index aa6737dbec1..462a0ffa04d 100644 --- a/v1/authorization/mocks/user_finder.go +++ b/v1/authorization/mocks/user_finder.go @@ -6,10 +6,11 @@ package mocks import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" influxdb "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" - reflect "reflect" ) // MockUserFinder is a mock of UserFinder interface diff --git a/v1/authorization/service.go b/v1/authorization/service.go index 86086a2544c..da8b6ac1364 100644 --- a/v1/authorization/service.go +++ b/v1/authorization/service.go @@ -4,10 +4,9 @@ import ( "context" "time" + "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/kv" ) diff --git a/v1/authorization/service_password.go b/v1/authorization/service_password.go index 1483aea4703..1ad8648924f 100644 --- a/v1/authorization/service_password.go +++ b/v1/authorization/service_password.go @@ -5,7 +5,6 @@ import ( "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/tenant" "golang.org/x/crypto/bcrypt" diff --git a/v1/authorization/storage.go b/v1/authorization/storage.go index 738ba3a3855..1f433c277f4 100644 --- a/v1/authorization/storage.go +++ b/v1/authorization/storage.go @@ -5,7 +5,6 @@ import ( "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2/kit/tracing" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/snowflake" diff --git a/v1/authorization/storage_authorization.go b/v1/authorization/storage_authorization.go index fe89c7680fc..50688b696d2 100644 --- a/v1/authorization/storage_authorization.go +++ b/v1/authorization/storage_authorization.go @@ -4,11 +4,10 @@ import ( "context" "encoding/json" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/buger/jsonparser" "github.com/influxdata/influxdb/v2" + "github.com/influxdata/influxdb/v2/kit/platform" + "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/kv" jsonp "github.com/influxdata/influxdb/v2/pkg/jsonparser" ) diff --git a/v1/authorization/storage_authorization_test.go b/v1/authorization/storage_authorization_test.go index 496ca490158..206c8575ec9 100644 --- a/v1/authorization/storage_authorization_test.go +++ b/v1/authorization/storage_authorization_test.go @@ -6,10 +6,9 @@ import ( "reflect" "testing" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/inmem" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kv" "github.com/influxdata/influxdb/v2/kv/migration/all" "github.com/influxdata/influxdb/v2/pkg/pointer" diff --git a/v1/authorization/storage_password.go b/v1/authorization/storage_password.go index 4912c4874b1..17d34d446bf 100644 --- a/v1/authorization/storage_password.go +++ b/v1/authorization/storage_password.go @@ -5,7 +5,6 @@ import ( "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2/kv" ) diff --git a/v1/coordinator/shard_mapper.go b/v1/coordinator/shard_mapper.go index cf3a02c70d1..8097856828c 100644 --- a/v1/coordinator/shard_mapper.go +++ b/v1/coordinator/shard_mapper.go @@ -6,10 +6,9 @@ import ( "io" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/influxql/query" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/tsdb" "github.com/influxdata/influxdb/v2/v1/services/meta" "github.com/influxdata/influxql" diff --git a/v1/coordinator/shard_mapper_test.go b/v1/coordinator/shard_mapper_test.go index 60bf240cb1c..b1f1607f40a 100644 --- a/v1/coordinator/shard_mapper_test.go +++ b/v1/coordinator/shard_mapper_test.go @@ -2,7 +2,6 @@ package coordinator_test import ( "context" - "github.com/influxdata/influxdb/v2/kit/platform" "reflect" "testing" "time" @@ -12,6 +11,7 @@ import ( "github.com/influxdata/influxdb/v2/dbrp/mocks" "github.com/influxdata/influxdb/v2/influxql/query" "github.com/influxdata/influxdb/v2/internal" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/tsdb" "github.com/influxdata/influxdb/v2/v1/coordinator" "github.com/influxdata/influxdb/v2/v1/services/meta" diff --git a/v1/coordinator/statement_executor.go b/v1/coordinator/statement_executor.go index 6352f090d69..6c30815e10f 100644 --- a/v1/coordinator/statement_executor.go +++ b/v1/coordinator/statement_executor.go @@ -7,12 +7,11 @@ import ( "strings" "time" - errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" - "github.com/influxdata/influxdb/v2" "github.com/influxdata/influxdb/v2/authorizer" iql "github.com/influxdata/influxdb/v2/influxql" "github.com/influxdata/influxdb/v2/influxql/query" + errors2 "github.com/influxdata/influxdb/v2/kit/platform/errors" "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxdb/v2/pkg/tracing" "github.com/influxdata/influxdb/v2/pkg/tracing/fields" diff --git a/v1/coordinator/statement_executor_test.go b/v1/coordinator/statement_executor_test.go index 388493541ea..1131f3684f3 100644 --- a/v1/coordinator/statement_executor_test.go +++ b/v1/coordinator/statement_executor_test.go @@ -10,8 +10,6 @@ import ( "testing" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/davecgh/go-spew/spew" "github.com/golang/mock/gomock" "github.com/influxdata/influxdb/v2" @@ -21,6 +19,7 @@ import ( "github.com/influxdata/influxdb/v2/influxql/control" "github.com/influxdata/influxdb/v2/influxql/query" "github.com/influxdata/influxdb/v2/internal" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/models" itesting "github.com/influxdata/influxdb/v2/testing" "github.com/influxdata/influxdb/v2/tsdb" diff --git a/v1/services/meta/data_internal_test.go b/v1/services/meta/data_internal_test.go index c49b4f3d9ec..0375863debe 100644 --- a/v1/services/meta/data_internal_test.go +++ b/v1/services/meta/data_internal_test.go @@ -2,9 +2,8 @@ package meta import ( "sort" - "time" - "testing" + "time" ) func TestShardGroupSort(t *testing.T) { diff --git a/v1/services/meta/data_test.go b/v1/services/meta/data_test.go index 73dd7f7b153..2dce80cb89a 100644 --- a/v1/services/meta/data_test.go +++ b/v1/services/meta/data_test.go @@ -9,9 +9,8 @@ import ( "github.com/influxdata/influxdb/v2/pkg/testing/assert" influxdb "github.com/influxdata/influxdb/v2/v1" - "github.com/influxdata/influxql" - "github.com/influxdata/influxdb/v2/v1/services/meta" + "github.com/influxdata/influxql" ) func init() { diff --git a/v1/services/storage/store.go b/v1/services/storage/store.go index 385b7a29d59..0f0bb41847f 100644 --- a/v1/services/storage/store.go +++ b/v1/services/storage/store.go @@ -7,10 +7,9 @@ import ( "sort" "time" - "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/gogo/protobuf/proto" "github.com/influxdata/influxdb/v2/influxql/query" + "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/models" "github.com/influxdata/influxdb/v2/pkg/slices" "github.com/influxdata/influxdb/v2/storage/reads" diff --git a/vault/secret.go b/vault/secret.go index 305aaf2573a..7c95a4258b5 100644 --- a/vault/secret.go +++ b/vault/secret.go @@ -7,10 +7,9 @@ import ( "strconv" "time" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - "github.com/hashicorp/vault/api" platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" ) var _ platform.SecretService = (*SecretService)(nil) diff --git a/zap/auth_service.go b/zap/auth_service.go index ac1b019b7d6..6fedaed3288 100644 --- a/zap/auth_service.go +++ b/zap/auth_service.go @@ -3,9 +3,8 @@ package zap import ( "context" - platform2 "github.com/influxdata/influxdb/v2/kit/platform" - platform "github.com/influxdata/influxdb/v2" + platform2 "github.com/influxdata/influxdb/v2/kit/platform" "go.uber.org/zap" ) diff --git a/zap/tracer.go b/zap/tracer.go index 43f5028e38d..89e23c907b5 100644 --- a/zap/tracer.go +++ b/zap/tracer.go @@ -9,7 +9,6 @@ import ( "time" platform2 "github.com/influxdata/influxdb/v2/kit/platform" - opentracing "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/log" "go.uber.org/zap"