From fa13dbd381e9de3b0c5658f562882db7a63fdd0b Mon Sep 17 00:00:00 2001 From: Josh Black Date: Tue, 13 Feb 2024 14:07:02 -0800 Subject: [PATCH] add gosimport to make fmt and run it (#25383) * add gosimport to make fmt and run it * move installation to tools.sh * correct weird spacing issue * Update Makefile Co-authored-by: Nick Cabatoff * fix a weird issue --------- Co-authored-by: Nick Cabatoff --- Makefile | 5 ++- api/plugin_helpers.go | 1 - audit/hashstructure_test.go | 1 - audit/nodes_test.go | 10 ++--- builtin/credential/approle/backend_test.go | 3 +- builtin/credential/aws/path_config_client.go | 1 - builtin/credential/aws/path_login.go | 1 - builtin/credential/aws/path_login_test.go | 3 +- builtin/credential/cert/path_certs.go | 1 - builtin/credential/cert/path_crls_test.go | 1 - builtin/credential/cert/path_login.go | 5 +-- builtin/credential/cert/path_login_test.go | 7 +--- builtin/credential/ldap/backend.go | 1 - .../ldap/path_config_rotate_root.go | 4 +- builtin/credential/okta/path_groups_test.go | 1 - builtin/credential/radius/path_login.go | 5 +-- .../credential/userpass/path_user_password.go | 3 +- builtin/logical/aws/client.go | 1 - builtin/logical/aws/path_config_root.go | 1 - builtin/logical/aws/path_static_creds_test.go | 2 - builtin/logical/aws/path_static_roles_test.go | 3 +- builtin/logical/aws/rotation_test.go | 3 +- builtin/logical/aws/secret_access_keys.go | 9 ++--- .../database/path_config_connection.go | 1 - builtin/logical/pki/acme_billing_test.go | 4 +- builtin/logical/pki/acme_challenges_test.go | 1 - builtin/logical/pki/acme_wrappers.go | 3 +- builtin/logical/pki/backend.go | 7 ++-- builtin/logical/pki/backend_test.go | 19 ++++------ builtin/logical/pki/ca_util.go | 8 ++-- builtin/logical/pki/cert_util_test.go | 7 ++-- builtin/logical/pki/crl_test.go | 4 +- builtin/logical/pki/integration_test.go | 3 +- builtin/logical/pki/issuing/issue_common.go | 5 +-- builtin/logical/pki/issuing/issuers.go | 5 +-- builtin/logical/pki/issuing/keys.go | 3 +- builtin/logical/pki/key_util.go | 5 +-- builtin/logical/pki/path_acme_order.go | 9 ++--- builtin/logical/pki/path_acme_order_test.go | 3 +- builtin/logical/pki/path_acme_test.go | 10 ++--- builtin/logical/pki/path_fetch.go | 1 - builtin/logical/pki/path_fetch_keys.go | 10 ++--- builtin/logical/pki/path_issue_sign.go | 3 +- builtin/logical/pki/path_manage_keys.go | 3 +- builtin/logical/pki/path_manage_keys_test.go | 4 +- builtin/logical/pki/path_resign_crls_test.go | 6 +-- builtin/logical/pki/path_revoke.go | 6 +-- builtin/logical/pki/path_roles.go | 3 +- builtin/logical/pki/path_roles_test.go | 3 +- builtin/logical/pki/path_root.go | 13 +++---- builtin/logical/pki/path_tidy_test.go | 12 ++---- builtin/logical/pki/storage.go | 5 +-- builtin/logical/pki/util.go | 1 - builtin/logical/pkiext/test_helpers.go | 1 - builtin/logical/ssh/path_config_ca.go | 3 +- .../logical/ssh/path_config_zeroaddress.go | 1 - builtin/logical/transit/backend_test.go | 4 +- builtin/logical/transit/path_certificates.go | 3 +- builtin/logical/transit/path_encrypt.go | 1 - builtin/logical/transit/path_encrypt_test.go | 3 +- builtin/logical/transit/path_export_test.go | 3 +- builtin/logical/transit/path_hash.go | 3 +- builtin/logical/transit/path_keys.go | 3 +- .../logical/transit/path_sign_verify_test.go | 4 +- builtin/plugin/backend_lazyLoad_test.go | 6 +-- command/agent/config/config.go | 5 +-- command/agent/config/config_test.go | 3 +- command/agent/exec/exec.go | 3 +- command/agent/template/template.go | 4 +- command/agent/testing.go | 1 - command/agentproxyshared/auth/auth.go | 3 +- command/agentproxyshared/auth/azure/azure.go | 3 +- .../cache/cachememdb/cache_memdb_test.go | 3 +- command/agentproxyshared/cache/testing.go | 3 +- command/auth_help_test.go | 1 - command/auth_test.go | 1 - command/base.go | 3 +- command/base_predict_test.go | 1 - command/base_test.go | 3 +- command/command_test.go | 7 ++-- command/commands.go | 37 +++++++------------ .../healthcheck/pki_crl_validity_period.go | 3 +- .../healthcheck/pki_enable_acme_issuance.go | 1 - command/healthcheck/pki_enable_auto_tidy.go | 3 +- .../healthcheck/pki_role_no_store_false.go | 3 +- command/healthcheck/pki_tidy_last_run.go | 3 +- command/login_test.go | 1 - command/operator_diagnose.go | 6 +-- command/operator_diagnose_test.go | 3 +- command/operator_init.go | 3 +- command/operator_rekey_test.go | 3 +- command/pgp_test.go | 5 +-- command/pki_health_check.go | 3 +- command/pki_health_check_test.go | 3 +- command/pki_list_intermediate.go | 3 +- command/pki_reissue_intermediate.go | 1 - command/pki_verify_sign.go | 3 +- command/server/config_test_helpers.go | 3 +- command/server/listener.go | 3 -- command/transit_import_key.go | 4 +- command/transit_import_key_test.go | 1 - helper/builtinplugins/registry_test.go | 1 - helper/dhutil/dhutil.go | 3 +- helper/fairshare/jobmanager.go | 1 - helper/pkcs7/pkcs7.go | 3 +- helper/testhelpers/ldap/ldaphelper.go | 1 - http/forwarding_test.go | 3 +- http/handler_test.go | 5 +-- http/logical_test.go | 5 +-- http/sys_metrics_test.go | 3 +- http/util.go | 3 +- .../observability/event/sink_file_test.go | 4 +- internalshared/configutil/telemetry.go | 3 +- physical/azure/azure_test.go | 3 +- physical/cockroachdb/cockroachdb.go | 2 - physical/dynamodb/dynamodb.go | 6 +-- physical/dynamodb/dynamodb_test.go | 11 +++--- physical/foundationdb/foundationdb.go | 6 +-- physical/foundationdb/foundationdb_test.go | 7 +--- physical/foundationdb/foundationdbstub.go | 1 - physical/mysql/mysql.go | 5 +-- physical/mysql/mysql_test.go | 8 ++-- physical/raft/chunking_test.go | 2 +- physical/swift/swift.go | 3 +- physical/swift/swift_test.go | 3 +- plugins/database/cassandra/cassandra.go | 3 +- plugins/database/cassandra/cassandra_test.go | 3 +- plugins/database/mssql/mssql.go | 1 - plugins/database/mysql/mysql_test.go | 3 +- .../database/postgresql/postgresql_test.go | 8 ++-- sdk/database/dbplugin/grpc_transport.go | 5 +-- sdk/database/dbplugin/plugin.go | 3 +- sdk/database/dbplugin/v5/grpc_server_test.go | 5 +-- sdk/framework/backend.go | 3 +- sdk/framework/backend_test.go | 1 - sdk/helper/custommetadata/custom_metadata.go | 3 +- sdk/helper/keysutil/policy.go | 10 ++--- sdk/helper/keysutil/policy_test.go | 3 +- sdk/helper/ldaputil/config.go | 11 ++---- sdk/helper/pluginidentityutil/fields_test.go | 3 +- sdk/logical/testing.go | 3 +- sdk/physical/file/file.go | 1 - sdk/plugin/backend.go | 3 +- sdk/plugin/grpc_backend_server.go | 3 +- sdk/plugin/grpc_storage.go | 3 +- sdk/plugin/serve.go | 3 +- sdk/plugin/storage_test.go | 3 +- .../consul_service_registration_test.go | 3 +- tools/tools.sh | 2 + vault/acme_billing_system_view.go | 3 +- vault/auth_test.go | 3 +- vault/cluster/cluster.go | 5 +-- vault/core_metrics_test.go | 3 +- vault/core_test.go | 23 +++++------- vault/diagnose/output.go | 3 +- vault/external_tests/api/kv_test.go | 18 +++------ .../external_tests/api/sys_rekey_ext_test.go | 1 - .../metrics/core_metrics_int_test.go | 3 +- vault/external_tests/mfa/login_mfa_test.go | 3 +- .../misc/misc_binary/recovery_test.go | 3 +- .../plugin/external_plugin_test.go | 6 +-- vault/external_tests/quotas/quotas_test.go | 7 ++-- .../replication_binary/replication_test.go | 7 ++-- .../external_tests/router/router_ext_test.go | 10 ++--- .../sealmigration/testshared.go | 1 - vault/identity_store_entities.go | 3 +- vault/identity_store_test.go | 3 +- vault/init.go | 5 +-- vault/logical_system_quotas.go | 3 +- vault/plugin_reload.go | 3 +- vault/plugincatalog/plugin_catalog_test.go | 3 +- vault/plugincatalog/plugin_runtime_catalog.go | 1 - vault/quotas/quotas_util.go | 3 +- vault/rekey.go | 1 - vault/rekey_test.go | 1 - vault/router_test.go | 3 +- vault/seal.go | 2 - vault/seal/seal_test.go | 3 +- vault/seal/seal_testing.go | 6 +-- vault/seal_autoseal.go | 1 - vault/seal_autoseal_test.go | 7 +--- vault/seal_util_test.go | 3 +- vault/seal_wrapped_value.go | 3 +- vault/seal_wrapped_value_test.go | 3 +- vault/testing.go | 9 ++--- vault/ui_test.go | 3 +- 186 files changed, 257 insertions(+), 505 deletions(-) diff --git a/Makefile b/Makefile index 27be0f94b6..8416a3cd8c 100644 --- a/Makefile +++ b/Makefile @@ -224,7 +224,10 @@ proto: check-tools-external protoc-go-inject-tag -input=./helper/identity/types.pb.go protoc-go-inject-tag -input=./helper/identity/mfa/types.pb.go -fmt: +importfmt: check-tools-external + find . -name '*.go' | grep -v pb.go | grep -v vendor | xargs gosimports -w + +fmt: importfmt find . -name '*.go' | grep -v pb.go | grep -v vendor | xargs gofumpt -w fmtcheck: check-go-fmt diff --git a/api/plugin_helpers.go b/api/plugin_helpers.go index 3705c7310a..5d2593668b 100644 --- a/api/plugin_helpers.go +++ b/api/plugin_helpers.go @@ -14,7 +14,6 @@ import ( "os" "github.com/go-jose/go-jose/v3/jwt" - "github.com/hashicorp/errwrap" ) diff --git a/audit/hashstructure_test.go b/audit/hashstructure_test.go index 771da02033..f437b3e14c 100644 --- a/audit/hashstructure_test.go +++ b/audit/hashstructure_test.go @@ -13,7 +13,6 @@ import ( "time" "github.com/go-test/deep" - "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/helper/salt" "github.com/hashicorp/vault/sdk/helper/wrapping" diff --git a/audit/nodes_test.go b/audit/nodes_test.go index 3aa4ef5332..f2aca0bc25 100644 --- a/audit/nodes_test.go +++ b/audit/nodes_test.go @@ -7,15 +7,11 @@ import ( "context" "testing" - "github.com/hashicorp/vault/helper/namespace" - - "github.com/hashicorp/go-uuid" - - "github.com/hashicorp/vault/sdk/logical" - "github.com/hashicorp/eventlogger" - + "github.com/hashicorp/go-uuid" + "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/internal/observability/event" + "github.com/hashicorp/vault/sdk/logical" "github.com/stretchr/testify/require" ) diff --git a/builtin/credential/approle/backend_test.go b/builtin/credential/approle/backend_test.go index a3dc68be06..95912952d8 100644 --- a/builtin/credential/approle/backend_test.go +++ b/builtin/credential/approle/backend_test.go @@ -8,9 +8,8 @@ import ( "strings" "testing" - "github.com/stretchr/testify/require" - "github.com/hashicorp/vault/sdk/logical" + "github.com/stretchr/testify/require" ) func createBackendWithStorage(t *testing.T) (*backend, logical.Storage) { diff --git a/builtin/credential/aws/path_config_client.go b/builtin/credential/aws/path_config_client.go index ed6e5d8981..c212372062 100644 --- a/builtin/credential/aws/path_config_client.go +++ b/builtin/credential/aws/path_config_client.go @@ -13,7 +13,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/hashicorp/go-secure-stdlib/strutil" - "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/logical" ) diff --git a/builtin/credential/aws/path_login.go b/builtin/credential/aws/path_login.go index b66146d1ee..c4330ad6af 100644 --- a/builtin/credential/aws/path_login.go +++ b/builtin/credential/aws/path_login.go @@ -32,7 +32,6 @@ import ( "github.com/hashicorp/go-secure-stdlib/parseutil" "github.com/hashicorp/go-secure-stdlib/strutil" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/vault/helper/pkcs7" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/cidrutil" diff --git a/builtin/credential/aws/path_login_test.go b/builtin/credential/aws/path_login_test.go index b3a9c63913..fe4a3a766b 100644 --- a/builtin/credential/aws/path_login_test.go +++ b/builtin/credential/aws/path_login_test.go @@ -16,9 +16,8 @@ import ( "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sts" - "github.com/stretchr/testify/assert" - "github.com/hashicorp/vault/sdk/logical" + "github.com/stretchr/testify/assert" ) func TestBackend_pathLogin_getCallerIdentityResponse(t *testing.T) { diff --git a/builtin/credential/cert/path_certs.go b/builtin/credential/cert/path_certs.go index 4e8cdc2743..32def783b4 100644 --- a/builtin/credential/cert/path_certs.go +++ b/builtin/credential/cert/path_certs.go @@ -11,7 +11,6 @@ import ( "time" "github.com/hashicorp/go-sockaddr" - "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/tokenutil" "github.com/hashicorp/vault/sdk/logical" diff --git a/builtin/credential/cert/path_crls_test.go b/builtin/credential/cert/path_crls_test.go index fff11d588a..26a47b3293 100644 --- a/builtin/credential/cert/path_crls_test.go +++ b/builtin/credential/cert/path_crls_test.go @@ -19,7 +19,6 @@ import ( "time" "github.com/hashicorp/vault/helper/testhelpers/corehelpers" - "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/logical" diff --git a/builtin/credential/cert/path_login.go b/builtin/credential/cert/path_login.go index ea8ba9748b..55df7e0b0b 100644 --- a/builtin/credential/cert/path_login.go +++ b/builtin/credential/cert/path_login.go @@ -16,15 +16,14 @@ import ( "fmt" "strings" + "github.com/hashicorp/errwrap" + "github.com/hashicorp/go-multierror" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/helper/cidrutil" "github.com/hashicorp/vault/sdk/helper/ocsp" "github.com/hashicorp/vault/sdk/helper/policyutil" "github.com/hashicorp/vault/sdk/logical" - - "github.com/hashicorp/errwrap" - "github.com/hashicorp/go-multierror" glob "github.com/ryanuber/go-glob" ) diff --git a/builtin/credential/cert/path_login_test.go b/builtin/credential/cert/path_login_test.go index 53be24c311..e64170bf4d 100644 --- a/builtin/credential/cert/path_login_test.go +++ b/builtin/credential/cert/path_login_test.go @@ -20,13 +20,10 @@ import ( "testing" "time" - "github.com/hashicorp/vault/sdk/helper/certutil" - - "golang.org/x/crypto/ocsp" - logicaltest "github.com/hashicorp/vault/helper/testhelpers/logical" - + "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/logical" + "golang.org/x/crypto/ocsp" ) var ocspPort int diff --git a/builtin/credential/ldap/backend.go b/builtin/credential/ldap/backend.go index 3f203fb13b..a649bbbde4 100644 --- a/builtin/credential/ldap/backend.go +++ b/builtin/credential/ldap/backend.go @@ -11,7 +11,6 @@ import ( "github.com/hashicorp/cap/ldap" "github.com/hashicorp/go-secure-stdlib/strutil" - "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/ldaputil" "github.com/hashicorp/vault/sdk/logical" diff --git a/builtin/credential/ldap/path_config_rotate_root.go b/builtin/credential/ldap/path_config_rotate_root.go index 1aa008f4dd..e095bc3503 100644 --- a/builtin/credential/ldap/path_config_rotate_root.go +++ b/builtin/credential/ldap/path_config_rotate_root.go @@ -7,11 +7,9 @@ import ( "context" "github.com/go-ldap/ldap/v3" - + "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/base62" "github.com/hashicorp/vault/sdk/helper/ldaputil" - - "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/logical" ) diff --git a/builtin/credential/okta/path_groups_test.go b/builtin/credential/okta/path_groups_test.go index 7ca8a94151..f8fac1d2fe 100644 --- a/builtin/credential/okta/path_groups_test.go +++ b/builtin/credential/okta/path_groups_test.go @@ -10,7 +10,6 @@ import ( "time" "github.com/go-test/deep" - log "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/sdk/helper/logging" "github.com/hashicorp/vault/sdk/logical" diff --git a/builtin/credential/radius/path_login.go b/builtin/credential/radius/path_login.go index 995b6a8177..b38e90cdf2 100644 --- a/builtin/credential/radius/path_login.go +++ b/builtin/credential/radius/path_login.go @@ -11,13 +11,12 @@ import ( "strings" "time" - "layeh.com/radius" - . "layeh.com/radius/rfc2865" - "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/cidrutil" "github.com/hashicorp/vault/sdk/helper/policyutil" "github.com/hashicorp/vault/sdk/logical" + "layeh.com/radius" + . "layeh.com/radius/rfc2865" ) func pathLogin(b *backend) *framework.Path { diff --git a/builtin/credential/userpass/path_user_password.go b/builtin/credential/userpass/path_user_password.go index 48b1275079..1f2a9c670f 100644 --- a/builtin/credential/userpass/path_user_password.go +++ b/builtin/credential/userpass/path_user_password.go @@ -7,10 +7,9 @@ import ( "context" "fmt" - "golang.org/x/crypto/bcrypt" - "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/logical" + "golang.org/x/crypto/bcrypt" ) func pathUserPassword(b *backend) *framework.Path { diff --git a/builtin/logical/aws/client.go b/builtin/logical/aws/client.go index c65b2469ea..dd6a581966 100644 --- a/builtin/logical/aws/client.go +++ b/builtin/logical/aws/client.go @@ -18,7 +18,6 @@ import ( "github.com/hashicorp/go-cleanhttp" "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-secure-stdlib/awsutil" - "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/sdk/helper/pluginutil" "github.com/hashicorp/vault/sdk/logical" diff --git a/builtin/logical/aws/path_config_root.go b/builtin/logical/aws/path_config_root.go index d2c64bbaa5..a361395eee 100644 --- a/builtin/logical/aws/path_config_root.go +++ b/builtin/logical/aws/path_config_root.go @@ -7,7 +7,6 @@ import ( "context" "github.com/aws/aws-sdk-go/aws" - "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/pluginidentityutil" "github.com/hashicorp/vault/sdk/logical" diff --git a/builtin/logical/aws/path_static_creds_test.go b/builtin/logical/aws/path_static_creds_test.go index e4ef5b2636..e128a5f073 100644 --- a/builtin/logical/aws/path_static_creds_test.go +++ b/builtin/logical/aws/path_static_creds_test.go @@ -9,9 +9,7 @@ import ( "testing" "github.com/fatih/structs" - "github.com/hashicorp/vault/sdk/framework" - "github.com/hashicorp/vault/sdk/logical" ) diff --git a/builtin/logical/aws/path_static_roles_test.go b/builtin/logical/aws/path_static_roles_test.go index a56225b575..0244d6a39c 100644 --- a/builtin/logical/aws/path_static_roles_test.go +++ b/builtin/logical/aws/path_static_roles_test.go @@ -9,13 +9,12 @@ import ( "testing" "time" - "github.com/hashicorp/vault/sdk/queue" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/iam" "github.com/hashicorp/go-secure-stdlib/awsutil" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/logical" + "github.com/hashicorp/vault/sdk/queue" ) // TestStaticRolesValidation verifies that valid requests pass validation and that invalid requests fail validation. diff --git a/builtin/logical/aws/rotation_test.go b/builtin/logical/aws/rotation_test.go index 5b85d456c3..51de3141b0 100644 --- a/builtin/logical/aws/rotation_test.go +++ b/builtin/logical/aws/rotation_test.go @@ -9,10 +9,9 @@ import ( "testing" "time" - "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/iam" + "github.com/aws/aws-sdk-go/service/iam/iamiface" "github.com/hashicorp/go-secure-stdlib/awsutil" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/sdk/queue" diff --git a/builtin/logical/aws/secret_access_keys.go b/builtin/logical/aws/secret_access_keys.go index 60fe8015f4..151a9a5cd7 100644 --- a/builtin/logical/aws/secret_access_keys.go +++ b/builtin/logical/aws/secret_access_keys.go @@ -9,15 +9,14 @@ import ( "regexp" "time" - "github.com/hashicorp/go-secure-stdlib/awsutil" - "github.com/hashicorp/vault/sdk/framework" - "github.com/hashicorp/vault/sdk/helper/template" - "github.com/hashicorp/vault/sdk/logical" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/sts" "github.com/hashicorp/errwrap" + "github.com/hashicorp/go-secure-stdlib/awsutil" + "github.com/hashicorp/vault/sdk/framework" + "github.com/hashicorp/vault/sdk/helper/template" + "github.com/hashicorp/vault/sdk/logical" ) const ( diff --git a/builtin/logical/database/path_config_connection.go b/builtin/logical/database/path_config_connection.go index 6e08cf4bc5..2f8f40a1bf 100644 --- a/builtin/logical/database/path_config_connection.go +++ b/builtin/logical/database/path_config_connection.go @@ -14,7 +14,6 @@ import ( "github.com/fatih/structs" "github.com/hashicorp/go-uuid" "github.com/hashicorp/go-version" - "github.com/hashicorp/vault/helper/versions" v5 "github.com/hashicorp/vault/sdk/database/dbplugin/v5" "github.com/hashicorp/vault/sdk/framework" diff --git a/builtin/logical/pki/acme_billing_test.go b/builtin/logical/pki/acme_billing_test.go index b17a3492ed..1911d6804e 100644 --- a/builtin/logical/pki/acme_billing_test.go +++ b/builtin/logical/pki/acme_billing_test.go @@ -15,16 +15,14 @@ import ( "testing" "time" - "golang.org/x/crypto/acme" - "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/builtin/logical/pki/dnstest" "github.com/hashicorp/vault/helper/constants" "github.com/hashicorp/vault/helper/timeutil" "github.com/hashicorp/vault/vault" "github.com/hashicorp/vault/vault/activity" - "github.com/stretchr/testify/require" + "golang.org/x/crypto/acme" ) // TestACMEBilling is a basic test that will validate client counts created via ACME workflows. diff --git a/builtin/logical/pki/acme_challenges_test.go b/builtin/logical/pki/acme_challenges_test.go index 591486d696..c1b919be75 100644 --- a/builtin/logical/pki/acme_challenges_test.go +++ b/builtin/logical/pki/acme_challenges_test.go @@ -26,7 +26,6 @@ import ( "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/builtin/logical/pki/dnstest" - "github.com/stretchr/testify/require" ) diff --git a/builtin/logical/pki/acme_wrappers.go b/builtin/logical/pki/acme_wrappers.go index ff3e72b935..febe48b9e4 100644 --- a/builtin/logical/pki/acme_wrappers.go +++ b/builtin/logical/pki/acme_wrappers.go @@ -11,10 +11,9 @@ import ( "net/url" "strings" + "github.com/hashicorp/vault/builtin/logical/pki/issuing" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/logical" - - "github.com/hashicorp/vault/builtin/logical/pki/issuing" ) type acmeContext struct { diff --git a/builtin/logical/pki/backend.go b/builtin/logical/pki/backend.go index 900bcaa311..566f5c255f 100644 --- a/builtin/logical/pki/backend.go +++ b/builtin/logical/pki/backend.go @@ -13,16 +13,15 @@ import ( "github.com/armon/go-metrics" "github.com/hashicorp/go-multierror" + "github.com/hashicorp/vault/builtin/logical/pki/issuing" + "github.com/hashicorp/vault/builtin/logical/pki/managed_key" + "github.com/hashicorp/vault/builtin/logical/pki/pki_backend" "github.com/hashicorp/vault/helper/metricsutil" "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/logical" - - "github.com/hashicorp/vault/builtin/logical/pki/issuing" - "github.com/hashicorp/vault/builtin/logical/pki/managed_key" - "github.com/hashicorp/vault/builtin/logical/pki/pki_backend" ) const ( diff --git a/builtin/logical/pki/backend_test.go b/builtin/logical/pki/backend_test.go index 7ea97ece11..46b9c16f50 100644 --- a/builtin/logical/pki/backend_test.go +++ b/builtin/logical/pki/backend_test.go @@ -35,16 +35,6 @@ import ( "testing" "time" - "github.com/hashicorp/vault/builtin/logical/pki/parsing" - "github.com/hashicorp/vault/helper/testhelpers/teststorage" - "golang.org/x/exp/maps" - - "github.com/hashicorp/vault/helper/testhelpers" - - "github.com/hashicorp/vault/sdk/helper/testhelpers/schema" - - "github.com/stretchr/testify/require" - "github.com/armon/go-metrics" "github.com/fatih/structs" "github.com/go-test/deep" @@ -52,15 +42,20 @@ import ( "github.com/hashicorp/vault/api" auth "github.com/hashicorp/vault/api/auth/userpass" "github.com/hashicorp/vault/builtin/credential/userpass" + "github.com/hashicorp/vault/builtin/logical/pki/issuing" + "github.com/hashicorp/vault/builtin/logical/pki/parsing" + "github.com/hashicorp/vault/helper/testhelpers" logicaltest "github.com/hashicorp/vault/helper/testhelpers/logical" + "github.com/hashicorp/vault/helper/testhelpers/teststorage" vaulthttp "github.com/hashicorp/vault/http" "github.com/hashicorp/vault/sdk/helper/certutil" + "github.com/hashicorp/vault/sdk/helper/testhelpers/schema" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/vault" "github.com/mitchellh/mapstructure" + "github.com/stretchr/testify/require" + "golang.org/x/exp/maps" "golang.org/x/net/idna" - - "github.com/hashicorp/vault/builtin/logical/pki/issuing" ) var stepCount = 0 diff --git a/builtin/logical/pki/ca_util.go b/builtin/logical/pki/ca_util.go index 2006684889..6f2f005217 100644 --- a/builtin/logical/pki/ca_util.go +++ b/builtin/logical/pki/ca_util.go @@ -13,14 +13,12 @@ import ( "io" "time" - "golang.org/x/crypto/ed25519" - + "github.com/hashicorp/vault/builtin/logical/pki/issuing" + "github.com/hashicorp/vault/builtin/logical/pki/managed_key" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/logical" - - "github.com/hashicorp/vault/builtin/logical/pki/issuing" - "github.com/hashicorp/vault/builtin/logical/pki/managed_key" + "golang.org/x/crypto/ed25519" ) func getGenerationParams(sc *storageContext, data *framework.FieldData) (exported bool, format string, role *issuing.RoleEntry, errorResp *logical.Response) { diff --git a/builtin/logical/pki/cert_util_test.go b/builtin/logical/pki/cert_util_test.go index c3fa0bde29..28618dde68 100644 --- a/builtin/logical/pki/cert_util_test.go +++ b/builtin/logical/pki/cert_util_test.go @@ -17,13 +17,12 @@ import ( "github.com/go-test/deep" "github.com/hashicorp/go-secure-stdlib/parseutil" - "github.com/hashicorp/vault/builtin/logical/pki/parsing" - "github.com/hashicorp/vault/sdk/helper/certutil" - "github.com/stretchr/testify/require" - "github.com/hashicorp/vault/builtin/logical/pki/issuing" + "github.com/hashicorp/vault/builtin/logical/pki/parsing" "github.com/hashicorp/vault/sdk/framework" + "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/logical" + "github.com/stretchr/testify/require" ) func TestPki_FetchCertBySerial(t *testing.T) { diff --git a/builtin/logical/pki/crl_test.go b/builtin/logical/pki/crl_test.go index fdda768a8b..28f38063ad 100644 --- a/builtin/logical/pki/crl_test.go +++ b/builtin/logical/pki/crl_test.go @@ -12,6 +12,7 @@ import ( "testing" "time" + "github.com/hashicorp/go-secure-stdlib/parseutil" "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/builtin/logical/pki/issuing" "github.com/hashicorp/vault/helper/constants" @@ -19,9 +20,6 @@ import ( "github.com/hashicorp/vault/sdk/helper/testhelpers/schema" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/vault" - - "github.com/hashicorp/go-secure-stdlib/parseutil" - "github.com/stretchr/testify/require" ) diff --git a/builtin/logical/pki/integration_test.go b/builtin/logical/pki/integration_test.go index 9432780a53..b4550d3f05 100644 --- a/builtin/logical/pki/integration_test.go +++ b/builtin/logical/pki/integration_test.go @@ -14,6 +14,7 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/builtin/logical/pki/issuing" vaulthttp "github.com/hashicorp/vault/http" @@ -21,8 +22,6 @@ import ( "github.com/hashicorp/vault/sdk/helper/testhelpers/schema" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/vault" - - "github.com/hashicorp/go-hclog" "github.com/stretchr/testify/require" ) diff --git a/builtin/logical/pki/issuing/issue_common.go b/builtin/logical/pki/issuing/issue_common.go index af1c9f4e8f..e9a496258c 100644 --- a/builtin/logical/pki/issuing/issue_common.go +++ b/builtin/logical/pki/issuing/issue_common.go @@ -16,15 +16,14 @@ import ( "time" "github.com/hashicorp/go-secure-stdlib/strutil" + "github.com/hashicorp/vault/builtin/logical/pki/parsing" + "github.com/hashicorp/vault/builtin/logical/pki/pki_backend" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/logical" "github.com/ryanuber/go-glob" "golang.org/x/net/idna" - - "github.com/hashicorp/vault/builtin/logical/pki/parsing" - "github.com/hashicorp/vault/builtin/logical/pki/pki_backend" ) var ( diff --git a/builtin/logical/pki/issuing/issuers.go b/builtin/logical/pki/issuing/issuers.go index 24343aec7e..a3e3658157 100644 --- a/builtin/logical/pki/issuing/issuers.go +++ b/builtin/logical/pki/issuing/issuers.go @@ -11,12 +11,11 @@ import ( "strings" "time" + "github.com/hashicorp/vault/builtin/logical/pki/managed_key" + "github.com/hashicorp/vault/builtin/logical/pki/parsing" "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/logical" - - "github.com/hashicorp/vault/builtin/logical/pki/managed_key" - "github.com/hashicorp/vault/builtin/logical/pki/parsing" ) const ( diff --git a/builtin/logical/pki/issuing/keys.go b/builtin/logical/pki/issuing/keys.go index c4cc62ff24..0e703ddc6c 100644 --- a/builtin/logical/pki/issuing/keys.go +++ b/builtin/logical/pki/issuing/keys.go @@ -7,11 +7,10 @@ import ( "context" "fmt" + "github.com/hashicorp/vault/builtin/logical/pki/managed_key" "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/logical" - - "github.com/hashicorp/vault/builtin/logical/pki/managed_key" ) const ( diff --git a/builtin/logical/pki/key_util.go b/builtin/logical/pki/key_util.go index ba0f1c956e..c8538908aa 100644 --- a/builtin/logical/pki/key_util.go +++ b/builtin/logical/pki/key_util.go @@ -10,11 +10,10 @@ import ( "errors" "fmt" - "github.com/hashicorp/vault/sdk/helper/certutil" - "github.com/hashicorp/vault/sdk/helper/errutil" - "github.com/hashicorp/vault/builtin/logical/pki/issuing" "github.com/hashicorp/vault/builtin/logical/pki/managed_key" + "github.com/hashicorp/vault/sdk/helper/certutil" + "github.com/hashicorp/vault/sdk/helper/errutil" ) func comparePublicKey(sc *storageContext, key *issuing.KeyEntry, publicKey crypto.PublicKey) (bool, error) { diff --git a/builtin/logical/pki/path_acme_order.go b/builtin/logical/pki/path_acme_order.go index 7df867a5ee..c61f076b81 100644 --- a/builtin/logical/pki/path_acme_order.go +++ b/builtin/logical/pki/path_acme_order.go @@ -14,15 +14,12 @@ import ( "strings" "time" - "github.com/hashicorp/vault/sdk/helper/strutil" - - "github.com/hashicorp/vault/sdk/helper/certutil" - + "github.com/hashicorp/vault/builtin/logical/pki/issuing" "github.com/hashicorp/vault/sdk/framework" + "github.com/hashicorp/vault/sdk/helper/certutil" + "github.com/hashicorp/vault/sdk/helper/strutil" "github.com/hashicorp/vault/sdk/logical" "golang.org/x/net/idna" - - "github.com/hashicorp/vault/builtin/logical/pki/issuing" ) var maxAcmeCertTTL = 90 * (24 * time.Hour) diff --git a/builtin/logical/pki/path_acme_order_test.go b/builtin/logical/pki/path_acme_order_test.go index b41bae157b..01472536ce 100644 --- a/builtin/logical/pki/path_acme_order_test.go +++ b/builtin/logical/pki/path_acme_order_test.go @@ -7,11 +7,10 @@ import ( "net" "testing" + "github.com/hashicorp/vault/builtin/logical/pki/issuing" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/logical" "github.com/stretchr/testify/require" - - "github.com/hashicorp/vault/builtin/logical/pki/issuing" ) // TestACME_ValidateIdentifiersAgainstRole Verify the ACME order creation diff --git a/builtin/logical/pki/path_acme_test.go b/builtin/logical/pki/path_acme_test.go index b378eda66c..cee8fe3607 100644 --- a/builtin/logical/pki/path_acme_test.go +++ b/builtin/logical/pki/path_acme_test.go @@ -24,22 +24,20 @@ import ( "testing" "time" - "github.com/hashicorp/vault/sdk/helper/certutil" - "github.com/go-test/deep" - "github.com/stretchr/testify/require" - "golang.org/x/crypto/acme" - "golang.org/x/net/http2" - "github.com/hashicorp/go-cleanhttp" "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/builtin/logical/pki/dnstest" "github.com/hashicorp/vault/helper/constants" "github.com/hashicorp/vault/helper/testhelpers" vaulthttp "github.com/hashicorp/vault/http" + "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/helper/jsonutil" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/vault" + "github.com/stretchr/testify/require" + "golang.org/x/crypto/acme" + "golang.org/x/net/http2" ) // TestAcmeBasicWorkflow a test that will validate a basic ACME workflow using the Golang ACME client. diff --git a/builtin/logical/pki/path_fetch.go b/builtin/logical/pki/path_fetch.go index da31c65f68..bdedbde429 100644 --- a/builtin/logical/pki/path_fetch.go +++ b/builtin/logical/pki/path_fetch.go @@ -13,7 +13,6 @@ import ( "github.com/hashicorp/vault/builtin/logical/pki/issuing" "github.com/hashicorp/vault/helper/constants" - "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/logical" diff --git a/builtin/logical/pki/path_fetch_keys.go b/builtin/logical/pki/path_fetch_keys.go index 4e112a22a7..0cf826d6f2 100644 --- a/builtin/logical/pki/path_fetch_keys.go +++ b/builtin/logical/pki/path_fetch_keys.go @@ -9,14 +9,12 @@ import ( "fmt" "net/http" - "github.com/hashicorp/vault/sdk/helper/certutil" - "github.com/hashicorp/vault/sdk/helper/errutil" - - "github.com/hashicorp/vault/sdk/framework" - "github.com/hashicorp/vault/sdk/logical" - "github.com/hashicorp/vault/builtin/logical/pki/issuing" "github.com/hashicorp/vault/builtin/logical/pki/managed_key" + "github.com/hashicorp/vault/sdk/framework" + "github.com/hashicorp/vault/sdk/helper/certutil" + "github.com/hashicorp/vault/sdk/helper/errutil" + "github.com/hashicorp/vault/sdk/logical" ) func pathListKeys(b *backend) *framework.Path { diff --git a/builtin/logical/pki/path_issue_sign.go b/builtin/logical/pki/path_issue_sign.go index dd30181990..e426a6af9f 100644 --- a/builtin/logical/pki/path_issue_sign.go +++ b/builtin/logical/pki/path_issue_sign.go @@ -14,13 +14,12 @@ import ( "strings" "time" + "github.com/hashicorp/vault/builtin/logical/pki/issuing" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/logical" - - "github.com/hashicorp/vault/builtin/logical/pki/issuing" ) func pathIssue(b *backend) *framework.Path { diff --git a/builtin/logical/pki/path_manage_keys.go b/builtin/logical/pki/path_manage_keys.go index 2b9297f118..a7727d9d6d 100644 --- a/builtin/logical/pki/path_manage_keys.go +++ b/builtin/logical/pki/path_manage_keys.go @@ -10,11 +10,10 @@ import ( "net/http" "strings" + "github.com/hashicorp/vault/builtin/logical/pki/managed_key" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/logical" - - "github.com/hashicorp/vault/builtin/logical/pki/managed_key" ) func pathGenerateKey(b *backend) *framework.Path { diff --git a/builtin/logical/pki/path_manage_keys_test.go b/builtin/logical/pki/path_manage_keys_test.go index 1fc671caa7..58c4222260 100644 --- a/builtin/logical/pki/path_manage_keys_test.go +++ b/builtin/logical/pki/path_manage_keys_test.go @@ -13,10 +13,8 @@ import ( "testing" "github.com/hashicorp/vault/builtin/logical/pki/issuing" - "github.com/hashicorp/vault/sdk/helper/testhelpers/schema" - "github.com/hashicorp/vault/sdk/helper/certutil" - + "github.com/hashicorp/vault/sdk/helper/testhelpers/schema" "github.com/hashicorp/vault/sdk/logical" "github.com/stretchr/testify/require" ) diff --git a/builtin/logical/pki/path_resign_crls_test.go b/builtin/logical/pki/path_resign_crls_test.go index d586a23539..2b2e1ede13 100644 --- a/builtin/logical/pki/path_resign_crls_test.go +++ b/builtin/logical/pki/path_resign_crls_test.go @@ -13,13 +13,11 @@ import ( "testing" "time" - "github.com/hashicorp/vault/sdk/helper/testhelpers/schema" - "github.com/hashicorp/vault/api" vaulthttp "github.com/hashicorp/vault/http" - "github.com/hashicorp/vault/vault" - + "github.com/hashicorp/vault/sdk/helper/testhelpers/schema" "github.com/hashicorp/vault/sdk/logical" + "github.com/hashicorp/vault/vault" "github.com/stretchr/testify/require" ) diff --git a/builtin/logical/pki/path_revoke.go b/builtin/logical/pki/path_revoke.go index c36034b613..0e9a376f3a 100644 --- a/builtin/logical/pki/path_revoke.go +++ b/builtin/logical/pki/path_revoke.go @@ -17,14 +17,12 @@ import ( "strings" "time" - "github.com/hashicorp/vault/sdk/helper/consts" - + "github.com/hashicorp/vault/builtin/logical/pki/issuing" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/certutil" + "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/logical" - - "github.com/hashicorp/vault/builtin/logical/pki/issuing" ) func pathListCertsRevoked(b *backend) *framework.Path { diff --git a/builtin/logical/pki/path_roles.go b/builtin/logical/pki/path_roles.go index 69f77fdce3..56bdc0aa8c 100644 --- a/builtin/logical/pki/path_roles.go +++ b/builtin/logical/pki/path_roles.go @@ -12,13 +12,12 @@ import ( "strings" "time" + "github.com/hashicorp/vault/builtin/logical/pki/issuing" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/logical" - - "github.com/hashicorp/vault/builtin/logical/pki/issuing" ) func pathListRoles(b *backend) *framework.Path { diff --git a/builtin/logical/pki/path_roles_test.go b/builtin/logical/pki/path_roles_test.go index b227832ce9..3b3d911c8f 100644 --- a/builtin/logical/pki/path_roles_test.go +++ b/builtin/logical/pki/path_roles_test.go @@ -14,12 +14,11 @@ import ( "github.com/go-errors/errors" "github.com/hashicorp/go-secure-stdlib/strutil" + "github.com/hashicorp/vault/builtin/logical/pki/issuing" "github.com/hashicorp/vault/sdk/helper/testhelpers/schema" "github.com/hashicorp/vault/sdk/logical" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "github.com/hashicorp/vault/builtin/logical/pki/issuing" ) func TestPki_RoleGenerateLease(t *testing.T) { diff --git a/builtin/logical/pki/path_root.go b/builtin/logical/pki/path_root.go index bf9ace1e56..07f3b5b062 100644 --- a/builtin/logical/pki/path_root.go +++ b/builtin/logical/pki/path_root.go @@ -20,16 +20,13 @@ import ( "strings" "time" - "golang.org/x/crypto/ed25519" - - "github.com/hashicorp/vault/sdk/helper/certutil" - - "github.com/hashicorp/vault/sdk/framework" - "github.com/hashicorp/vault/sdk/helper/errutil" - "github.com/hashicorp/vault/sdk/logical" - "github.com/hashicorp/vault/builtin/logical/pki/issuing" "github.com/hashicorp/vault/builtin/logical/pki/parsing" + "github.com/hashicorp/vault/sdk/framework" + "github.com/hashicorp/vault/sdk/helper/certutil" + "github.com/hashicorp/vault/sdk/helper/errutil" + "github.com/hashicorp/vault/sdk/logical" + "golang.org/x/crypto/ed25519" ) func pathGenerateRoot(b *backend) *framework.Path { diff --git a/builtin/logical/pki/path_tidy_test.go b/builtin/logical/pki/path_tidy_test.go index 1eb00c7f5b..46c9b5a89c 100644 --- a/builtin/logical/pki/path_tidy_test.go +++ b/builtin/logical/pki/path_tidy_test.go @@ -19,20 +19,16 @@ import ( "testing" "time" - "github.com/hashicorp/vault/sdk/helper/jsonutil" - "golang.org/x/crypto/acme" - - "github.com/hashicorp/vault/helper/testhelpers" - "github.com/hashicorp/vault/sdk/helper/testhelpers/schema" - "github.com/armon/go-metrics" - "github.com/hashicorp/vault/api" + "github.com/hashicorp/vault/helper/testhelpers" vaulthttp "github.com/hashicorp/vault/http" + "github.com/hashicorp/vault/sdk/helper/jsonutil" + "github.com/hashicorp/vault/sdk/helper/testhelpers/schema" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/vault" - "github.com/stretchr/testify/require" + "golang.org/x/crypto/acme" ) func TestTidyConfigs(t *testing.T) { diff --git a/builtin/logical/pki/storage.go b/builtin/logical/pki/storage.go index 6daeebd81f..67a0ff1c15 100644 --- a/builtin/logical/pki/storage.go +++ b/builtin/logical/pki/storage.go @@ -14,13 +14,12 @@ import ( "time" "github.com/hashicorp/go-uuid" + "github.com/hashicorp/vault/builtin/logical/pki/issuing" + "github.com/hashicorp/vault/builtin/logical/pki/managed_key" "github.com/hashicorp/vault/helper/constants" "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/logical" - - "github.com/hashicorp/vault/builtin/logical/pki/issuing" - "github.com/hashicorp/vault/builtin/logical/pki/managed_key" ) var ErrStorageItemNotFound = errors.New("storage item not found") diff --git a/builtin/logical/pki/util.go b/builtin/logical/pki/util.go index 6b98f4549d..50ea8f91cd 100644 --- a/builtin/logical/pki/util.go +++ b/builtin/logical/pki/util.go @@ -17,7 +17,6 @@ import ( "github.com/hashicorp/vault/builtin/logical/pki/managed_key" "github.com/hashicorp/vault/builtin/logical/pki/parsing" "github.com/hashicorp/vault/sdk/framework" - "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/logical" diff --git a/builtin/logical/pkiext/test_helpers.go b/builtin/logical/pkiext/test_helpers.go index 7f6abe36c1..0950923e31 100644 --- a/builtin/logical/pkiext/test_helpers.go +++ b/builtin/logical/pkiext/test_helpers.go @@ -14,7 +14,6 @@ import ( "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/logical" - "github.com/stretchr/testify/require" ) diff --git a/builtin/logical/ssh/path_config_ca.go b/builtin/logical/ssh/path_config_ca.go index f33c98d8a3..6d003c0ae5 100644 --- a/builtin/logical/ssh/path_config_ca.go +++ b/builtin/logical/ssh/path_config_ca.go @@ -20,9 +20,8 @@ import ( multierror "github.com/hashicorp/go-multierror" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/logical" - "golang.org/x/crypto/ssh" - "github.com/mikesmitty/edkey" + "golang.org/x/crypto/ssh" ) const ( diff --git a/builtin/logical/ssh/path_config_zeroaddress.go b/builtin/logical/ssh/path_config_zeroaddress.go index 2d463ab1bd..a84d03d7c4 100644 --- a/builtin/logical/ssh/path_config_zeroaddress.go +++ b/builtin/logical/ssh/path_config_zeroaddress.go @@ -8,7 +8,6 @@ import ( "fmt" "github.com/hashicorp/go-secure-stdlib/strutil" - "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/logical" ) diff --git a/builtin/logical/transit/backend_test.go b/builtin/logical/transit/backend_test.go index b7d5cc8b4b..528ccf6821 100644 --- a/builtin/logical/transit/backend_test.go +++ b/builtin/logical/transit/backend_test.go @@ -23,6 +23,7 @@ import ( "testing" "time" + uuid "github.com/hashicorp/go-uuid" "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/builtin/logical/pki" logicaltest "github.com/hashicorp/vault/helper/testhelpers/logical" @@ -32,10 +33,7 @@ import ( "github.com/hashicorp/vault/sdk/helper/keysutil" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/vault" - - uuid "github.com/hashicorp/go-uuid" "github.com/mitchellh/mapstructure" - "github.com/stretchr/testify/require" ) diff --git a/builtin/logical/transit/path_certificates.go b/builtin/logical/transit/path_certificates.go index bf61b8425e..aa4aeb55f6 100644 --- a/builtin/logical/transit/path_certificates.go +++ b/builtin/logical/transit/path_certificates.go @@ -11,9 +11,8 @@ import ( "fmt" "strings" - "github.com/hashicorp/vault/sdk/helper/errutil" - "github.com/hashicorp/vault/sdk/framework" + "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/helper/keysutil" "github.com/hashicorp/vault/sdk/logical" ) diff --git a/builtin/logical/transit/path_encrypt.go b/builtin/logical/transit/path_encrypt.go index 05199cae09..38c618f9b3 100644 --- a/builtin/logical/transit/path_encrypt.go +++ b/builtin/logical/transit/path_encrypt.go @@ -13,7 +13,6 @@ import ( "reflect" "github.com/hashicorp/vault/helper/constants" - "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/helper/keysutil" diff --git a/builtin/logical/transit/path_encrypt_test.go b/builtin/logical/transit/path_encrypt_test.go index 4f5088e8e6..e46d32a5f0 100644 --- a/builtin/logical/transit/path_encrypt_test.go +++ b/builtin/logical/transit/path_encrypt_test.go @@ -12,9 +12,8 @@ import ( "strings" "testing" - "github.com/hashicorp/vault/sdk/helper/keysutil" - uuid "github.com/hashicorp/go-uuid" + "github.com/hashicorp/vault/sdk/helper/keysutil" "github.com/hashicorp/vault/sdk/logical" "github.com/mitchellh/mapstructure" ) diff --git a/builtin/logical/transit/path_export_test.go b/builtin/logical/transit/path_export_test.go index 2ea6034635..b91ef47fb4 100644 --- a/builtin/logical/transit/path_export_test.go +++ b/builtin/logical/transit/path_export_test.go @@ -18,9 +18,8 @@ import ( "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/builtin/logical/pki" vaulthttp "github.com/hashicorp/vault/http" - "github.com/hashicorp/vault/vault" - "github.com/hashicorp/vault/sdk/logical" + "github.com/hashicorp/vault/vault" "github.com/stretchr/testify/require" ) diff --git a/builtin/logical/transit/path_hash.go b/builtin/logical/transit/path_hash.go index dfebe7e6a3..250822d0b9 100644 --- a/builtin/logical/transit/path_hash.go +++ b/builtin/logical/transit/path_hash.go @@ -12,10 +12,9 @@ import ( "fmt" "hash" - "golang.org/x/crypto/sha3" - "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/logical" + "golang.org/x/crypto/sha3" ) func (b *backend) pathHash() *framework.Path { diff --git a/builtin/logical/transit/path_keys.go b/builtin/logical/transit/path_keys.go index 63e6019a5c..bc931cc30c 100644 --- a/builtin/logical/transit/path_keys.go +++ b/builtin/logical/transit/path_keys.go @@ -13,12 +13,11 @@ import ( "strings" "time" - "golang.org/x/crypto/ed25519" - "github.com/fatih/structs" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/keysutil" "github.com/hashicorp/vault/sdk/logical" + "golang.org/x/crypto/ed25519" ) func (b *backend) pathListKeys() *framework.Path { diff --git a/builtin/logical/transit/path_sign_verify_test.go b/builtin/logical/transit/path_sign_verify_test.go index a7abf6be45..1421f71c34 100644 --- a/builtin/logical/transit/path_sign_verify_test.go +++ b/builtin/logical/transit/path_sign_verify_test.go @@ -12,12 +12,10 @@ import ( "testing" "github.com/hashicorp/vault/helper/constants" - - "golang.org/x/crypto/ed25519" - "github.com/hashicorp/vault/sdk/helper/keysutil" "github.com/hashicorp/vault/sdk/logical" "github.com/mitchellh/mapstructure" + "golang.org/x/crypto/ed25519" ) // The outcome of processing a request includes diff --git a/builtin/plugin/backend_lazyLoad_test.go b/builtin/plugin/backend_lazyLoad_test.go index 094047c03f..3e52cc14ac 100644 --- a/builtin/plugin/backend_lazyLoad_test.go +++ b/builtin/plugin/backend_lazyLoad_test.go @@ -8,12 +8,10 @@ import ( "errors" "testing" - "github.com/hashicorp/vault/sdk/helper/logging" - - "github.com/hashicorp/vault/sdk/helper/pluginutil" - "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/sdk/helper/consts" + "github.com/hashicorp/vault/sdk/helper/logging" + "github.com/hashicorp/vault/sdk/helper/pluginutil" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/sdk/plugin" ) diff --git a/command/agent/config/config.go b/command/agent/config/config.go index a03dfe39a4..0b14a3f098 100644 --- a/command/agent/config/config.go +++ b/command/agent/config/config.go @@ -21,13 +21,12 @@ import ( "github.com/hashicorp/go-secure-stdlib/parseutil" "github.com/hashicorp/hcl" "github.com/hashicorp/hcl/hcl/ast" - "github.com/mitchellh/mapstructure" - "k8s.io/utils/strings/slices" - "github.com/hashicorp/vault/command/agentproxyshared" "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/internalshared/configutil" "github.com/hashicorp/vault/sdk/helper/pointerutil" + "github.com/mitchellh/mapstructure" + "k8s.io/utils/strings/slices" ) // Config is the configuration for Vault Agent. diff --git a/command/agent/config/config_test.go b/command/agent/config/config_test.go index f729aec4be..6947f35906 100644 --- a/command/agent/config/config_test.go +++ b/command/agent/config/config_test.go @@ -11,11 +11,10 @@ import ( "github.com/go-test/deep" ctconfig "github.com/hashicorp/consul-template/config" - "golang.org/x/exp/slices" - "github.com/hashicorp/vault/command/agentproxyshared" "github.com/hashicorp/vault/internalshared/configutil" "github.com/hashicorp/vault/sdk/helper/pointerutil" + "golang.org/x/exp/slices" ) func TestLoadConfigFile_AgentCache(t *testing.T) { diff --git a/command/agent/exec/exec.go b/command/agent/exec/exec.go index 456b1d8ffc..d6da655453 100644 --- a/command/agent/exec/exec.go +++ b/command/agent/exec/exec.go @@ -16,12 +16,11 @@ import ( ctconfig "github.com/hashicorp/consul-template/config" "github.com/hashicorp/consul-template/manager" "github.com/hashicorp/go-hclog" - "golang.org/x/exp/slices" - "github.com/hashicorp/vault/command/agent/config" "github.com/hashicorp/vault/command/agent/internal/ctmanager" "github.com/hashicorp/vault/helper/useragent" "github.com/hashicorp/vault/sdk/helper/pointerutil" + "golang.org/x/exp/slices" ) type childProcessState uint8 diff --git a/command/agent/template/template.go b/command/agent/template/template.go index b0fa9326ab..cc03b7e96f 100644 --- a/command/agent/template/template.go +++ b/command/agent/template/template.go @@ -14,16 +14,14 @@ import ( "fmt" "io" - "go.uber.org/atomic" - ctconfig "github.com/hashicorp/consul-template/config" "github.com/hashicorp/consul-template/manager" "github.com/hashicorp/go-hclog" - "github.com/hashicorp/vault/command/agent/config" "github.com/hashicorp/vault/command/agent/internal/ctmanager" "github.com/hashicorp/vault/helper/useragent" "github.com/hashicorp/vault/sdk/helper/pointerutil" + "go.uber.org/atomic" ) // ServerConfig is a config struct for setting up the basic parts of the diff --git a/command/agent/testing.go b/command/agent/testing.go index f3260c1483..d8c405490f 100644 --- a/command/agent/testing.go +++ b/command/agent/testing.go @@ -15,7 +15,6 @@ import ( "github.com/go-jose/go-jose/v3" "github.com/go-jose/go-jose/v3/jwt" - "github.com/hashicorp/vault/sdk/logical" ) diff --git a/command/agentproxyshared/auth/auth.go b/command/agentproxyshared/auth/auth.go index 0017acd34c..9b880c0e6d 100644 --- a/command/agentproxyshared/auth/auth.go +++ b/command/agentproxyshared/auth/auth.go @@ -14,9 +14,8 @@ import ( "github.com/armon/go-metrics" "github.com/hashicorp/go-hclog" - "github.com/hashicorp/vault/sdk/helper/backoff" - "github.com/hashicorp/vault/api" + "github.com/hashicorp/vault/sdk/helper/backoff" "github.com/hashicorp/vault/sdk/helper/jsonutil" ) diff --git a/command/agentproxyshared/auth/azure/azure.go b/command/agentproxyshared/auth/azure/azure.go index 8db5ff5093..00e8fea6e2 100644 --- a/command/agentproxyshared/auth/azure/azure.go +++ b/command/agentproxyshared/auth/azure/azure.go @@ -10,12 +10,11 @@ import ( "io" "net/http" - "github.com/hashicorp/go-secure-stdlib/parseutil" - policy "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" az "github.com/Azure/azure-sdk-for-go/sdk/azidentity" cleanhttp "github.com/hashicorp/go-cleanhttp" hclog "github.com/hashicorp/go-hclog" + "github.com/hashicorp/go-secure-stdlib/parseutil" "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/command/agentproxyshared/auth" "github.com/hashicorp/vault/helper/useragent" diff --git a/command/agentproxyshared/cache/cachememdb/cache_memdb_test.go b/command/agentproxyshared/cache/cachememdb/cache_memdb_test.go index 63959141d6..245f066281 100644 --- a/command/agentproxyshared/cache/cachememdb/cache_memdb_test.go +++ b/command/agentproxyshared/cache/cachememdb/cache_memdb_test.go @@ -7,9 +7,8 @@ import ( "context" "testing" - "github.com/stretchr/testify/require" - "github.com/go-test/deep" + "github.com/stretchr/testify/require" ) func testContextInfo() *ContextInfo { diff --git a/command/agentproxyshared/cache/testing.go b/command/agentproxyshared/cache/testing.go index 4bc2e1d025..72ff895e5b 100644 --- a/command/agentproxyshared/cache/testing.go +++ b/command/agentproxyshared/cache/testing.go @@ -13,9 +13,8 @@ import ( "strings" "time" - "github.com/hashicorp/vault/helper/useragent" - "github.com/hashicorp/vault/api" + "github.com/hashicorp/vault/helper/useragent" ) // mockProxier is a mock implementation of the Proxier interface, used for testing purposes. diff --git a/command/auth_help_test.go b/command/auth_help_test.go index e437f29199..3c0218b247 100644 --- a/command/auth_help_test.go +++ b/command/auth_help_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/hashicorp/cli" - credUserpass "github.com/hashicorp/vault/builtin/credential/userpass" ) diff --git a/command/auth_test.go b/command/auth_test.go index 9071c0c157..e6c895df8f 100644 --- a/command/auth_test.go +++ b/command/auth_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/hashicorp/cli" - "github.com/hashicorp/vault/command/token" ) diff --git a/command/base.go b/command/base.go index ab6abf6056..5acd2227fa 100644 --- a/command/base.go +++ b/command/base.go @@ -16,11 +16,10 @@ import ( "sync" "time" - "github.com/hashicorp/vault/command/config" - "github.com/hashicorp/cli" hcpvlib "github.com/hashicorp/vault-hcp-lib" "github.com/hashicorp/vault/api" + "github.com/hashicorp/vault/command/config" "github.com/hashicorp/vault/command/token" "github.com/hashicorp/vault/helper/namespace" "github.com/mattn/go-isatty" diff --git a/command/base_predict_test.go b/command/base_predict_test.go index 778245830f..4c17651ecd 100644 --- a/command/base_predict_test.go +++ b/command/base_predict_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/hashicorp/go-secure-stdlib/strutil" "github.com/hashicorp/vault/api" "github.com/posener/complete" diff --git a/command/base_test.go b/command/base_test.go index 028f13fb44..2be878a09b 100644 --- a/command/base_test.go +++ b/command/base_test.go @@ -8,11 +8,10 @@ import ( "reflect" "testing" + hcpvlib "github.com/hashicorp/vault-hcp-lib" "github.com/hashicorp/vault/api" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - hcpvlib "github.com/hashicorp/vault-hcp-lib" ) func getDefaultCliHeaders(t *testing.T) http.Header { diff --git a/command/command_test.go b/command/command_test.go index 5ef880b787..61171db5a5 100644 --- a/command/command_test.go +++ b/command/command_test.go @@ -17,19 +17,18 @@ import ( kv "github.com/hashicorp/vault-plugin-secrets-kv" "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/audit" + auditFile "github.com/hashicorp/vault/builtin/audit/file" + credUserpass "github.com/hashicorp/vault/builtin/credential/userpass" "github.com/hashicorp/vault/builtin/logical/pki" "github.com/hashicorp/vault/builtin/logical/ssh" "github.com/hashicorp/vault/builtin/logical/transit" "github.com/hashicorp/vault/helper/benchhelpers" "github.com/hashicorp/vault/helper/builtinplugins" + vaulthttp "github.com/hashicorp/vault/http" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/sdk/physical/inmem" "github.com/hashicorp/vault/vault" "github.com/hashicorp/vault/vault/seal" - - auditFile "github.com/hashicorp/vault/builtin/audit/file" - credUserpass "github.com/hashicorp/vault/builtin/credential/userpass" - vaulthttp "github.com/hashicorp/vault/http" ) var ( diff --git a/command/commands.go b/command/commands.go index b56ec2e8f0..ae57637921 100644 --- a/command/commands.go +++ b/command/commands.go @@ -9,25 +9,7 @@ import ( "syscall" "github.com/hashicorp/cli" - "github.com/hashicorp/vault/audit" - "github.com/hashicorp/vault/builtin/plugin" - "github.com/hashicorp/vault/plugins/event" - "github.com/hashicorp/vault/plugins/event/sqs" - "github.com/hashicorp/vault/sdk/logical" - "github.com/hashicorp/vault/sdk/physical" - "github.com/hashicorp/vault/version" - - /* - The builtinplugins package is initialized here because it, in turn, - initializes the database plugins. - They register multiple database drivers for the "database/sql" package. - */ - _ "github.com/hashicorp/vault/helper/builtinplugins" - - auditFile "github.com/hashicorp/vault/builtin/audit/file" - auditSocket "github.com/hashicorp/vault/builtin/audit/socket" - auditSyslog "github.com/hashicorp/vault/builtin/audit/syslog" - + hcpvlib "github.com/hashicorp/vault-hcp-lib" credAliCloud "github.com/hashicorp/vault-plugin-auth-alicloud" credCentrify "github.com/hashicorp/vault-plugin-auth-centrify" credCF "github.com/hashicorp/vault-plugin-auth-cf" @@ -35,6 +17,11 @@ import ( credOIDC "github.com/hashicorp/vault-plugin-auth-jwt" credKerb "github.com/hashicorp/vault-plugin-auth-kerberos" credOCI "github.com/hashicorp/vault-plugin-auth-oci" + logicalKv "github.com/hashicorp/vault-plugin-secrets-kv" + "github.com/hashicorp/vault/audit" + auditFile "github.com/hashicorp/vault/builtin/audit/file" + auditSocket "github.com/hashicorp/vault/builtin/audit/socket" + auditSyslog "github.com/hashicorp/vault/builtin/audit/syslog" credAws "github.com/hashicorp/vault/builtin/credential/aws" credCert "github.com/hashicorp/vault/builtin/credential/cert" credGitHub "github.com/hashicorp/vault/builtin/credential/github" @@ -42,10 +29,9 @@ import ( credOkta "github.com/hashicorp/vault/builtin/credential/okta" credToken "github.com/hashicorp/vault/builtin/credential/token" credUserpass "github.com/hashicorp/vault/builtin/credential/userpass" - - logicalKv "github.com/hashicorp/vault-plugin-secrets-kv" logicalDb "github.com/hashicorp/vault/builtin/logical/database" - + "github.com/hashicorp/vault/builtin/plugin" + _ "github.com/hashicorp/vault/helper/builtinplugins" physAerospike "github.com/hashicorp/vault/physical/aerospike" physAliCloudOSS "github.com/hashicorp/vault/physical/alicloudoss" physAzure "github.com/hashicorp/vault/physical/azure" @@ -67,13 +53,16 @@ import ( physSpanner "github.com/hashicorp/vault/physical/spanner" physSwift "github.com/hashicorp/vault/physical/swift" physZooKeeper "github.com/hashicorp/vault/physical/zookeeper" + "github.com/hashicorp/vault/plugins/event" + "github.com/hashicorp/vault/plugins/event/sqs" + "github.com/hashicorp/vault/sdk/logical" + "github.com/hashicorp/vault/sdk/physical" physFile "github.com/hashicorp/vault/sdk/physical/file" physInmem "github.com/hashicorp/vault/sdk/physical/inmem" - - hcpvlib "github.com/hashicorp/vault-hcp-lib" sr "github.com/hashicorp/vault/serviceregistration" csr "github.com/hashicorp/vault/serviceregistration/consul" ksr "github.com/hashicorp/vault/serviceregistration/kubernetes" + "github.com/hashicorp/vault/version" ) const ( diff --git a/command/healthcheck/pki_crl_validity_period.go b/command/healthcheck/pki_crl_validity_period.go index c4d6fd8edb..ad591fa9fb 100644 --- a/command/healthcheck/pki_crl_validity_period.go +++ b/command/healthcheck/pki_crl_validity_period.go @@ -8,9 +8,8 @@ import ( "fmt" "time" - "github.com/hashicorp/vault/sdk/logical" - "github.com/hashicorp/go-secure-stdlib/parseutil" + "github.com/hashicorp/vault/sdk/logical" ) type CRLValidityPeriod struct { diff --git a/command/healthcheck/pki_enable_acme_issuance.go b/command/healthcheck/pki_enable_acme_issuance.go index 853a3475e2..990cc37e9d 100644 --- a/command/healthcheck/pki_enable_acme_issuance.go +++ b/command/healthcheck/pki_enable_acme_issuance.go @@ -13,7 +13,6 @@ import ( "github.com/hashicorp/go-secure-stdlib/parseutil" "github.com/hashicorp/vault/sdk/logical" - "golang.org/x/crypto/acme" ) diff --git a/command/healthcheck/pki_enable_auto_tidy.go b/command/healthcheck/pki_enable_auto_tidy.go index cabab17a6b..d8a43ba0a6 100644 --- a/command/healthcheck/pki_enable_auto_tidy.go +++ b/command/healthcheck/pki_enable_auto_tidy.go @@ -7,9 +7,8 @@ import ( "fmt" "time" - "github.com/hashicorp/vault/sdk/logical" - "github.com/hashicorp/go-secure-stdlib/parseutil" + "github.com/hashicorp/vault/sdk/logical" ) type EnableAutoTidy struct { diff --git a/command/healthcheck/pki_role_no_store_false.go b/command/healthcheck/pki_role_no_store_false.go index 30db9dce12..94330cc1b8 100644 --- a/command/healthcheck/pki_role_no_store_false.go +++ b/command/healthcheck/pki_role_no_store_false.go @@ -6,9 +6,8 @@ package healthcheck import ( "fmt" - "github.com/hashicorp/vault/sdk/logical" - "github.com/hashicorp/go-secure-stdlib/parseutil" + "github.com/hashicorp/vault/sdk/logical" ) type RoleNoStoreFalse struct { diff --git a/command/healthcheck/pki_tidy_last_run.go b/command/healthcheck/pki_tidy_last_run.go index a3f1c929ca..a699325cbe 100644 --- a/command/healthcheck/pki_tidy_last_run.go +++ b/command/healthcheck/pki_tidy_last_run.go @@ -7,9 +7,8 @@ import ( "fmt" "time" - "github.com/hashicorp/vault/sdk/logical" - "github.com/hashicorp/go-secure-stdlib/parseutil" + "github.com/hashicorp/vault/sdk/logical" ) type TidyLastRun struct { diff --git a/command/login_test.go b/command/login_test.go index b8afeffbf2..3f7c01d3c8 100644 --- a/command/login_test.go +++ b/command/login_test.go @@ -11,7 +11,6 @@ import ( "time" "github.com/hashicorp/cli" - "github.com/hashicorp/vault/api" credToken "github.com/hashicorp/vault/builtin/credential/token" credUserpass "github.com/hashicorp/vault/builtin/credential/userpass" diff --git a/command/operator_diagnose.go b/command/operator_diagnose.go index a3f02fba97..460a24f101 100644 --- a/command/operator_diagnose.go +++ b/command/operator_diagnose.go @@ -14,13 +14,10 @@ import ( "sync" "time" - "github.com/hashicorp/go-kms-wrapping/entropy/v2" - - "golang.org/x/term" - "github.com/hashicorp/cli" "github.com/hashicorp/consul/api" log "github.com/hashicorp/go-hclog" + "github.com/hashicorp/go-kms-wrapping/entropy/v2" "github.com/hashicorp/go-secure-stdlib/reloadutil" uuid "github.com/hashicorp/go-uuid" cserver "github.com/hashicorp/vault/command/server" @@ -38,6 +35,7 @@ import ( "github.com/hashicorp/vault/vault/hcp_link" "github.com/hashicorp/vault/version" "github.com/posener/complete" + "golang.org/x/term" ) const CoreConfigUninitializedErr = "Diagnose cannot attempt this step because core config could not be set." diff --git a/command/operator_diagnose_test.go b/command/operator_diagnose_test.go index 8b15cc8b1d..9f7fbde762 100644 --- a/command/operator_diagnose_test.go +++ b/command/operator_diagnose_test.go @@ -13,9 +13,8 @@ import ( "strings" "testing" - "github.com/hashicorp/vault/command/server" - "github.com/hashicorp/cli" + "github.com/hashicorp/vault/command/server" "github.com/hashicorp/vault/vault/diagnose" ) diff --git a/command/operator_init.go b/command/operator_init.go index 576f7fe2dc..b4b5de9759 100644 --- a/command/operator_init.go +++ b/command/operator_init.go @@ -10,11 +10,10 @@ import ( "strings" "github.com/hashicorp/cli" + consulapi "github.com/hashicorp/consul/api" "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/helper/pgpkeys" "github.com/posener/complete" - - consulapi "github.com/hashicorp/consul/api" ) var ( diff --git a/command/operator_rekey_test.go b/command/operator_rekey_test.go index b21d9c367b..d8a4ee2537 100644 --- a/command/operator_rekey_test.go +++ b/command/operator_rekey_test.go @@ -12,10 +12,9 @@ import ( "strings" "testing" - "github.com/hashicorp/vault/sdk/helper/roottoken" - "github.com/hashicorp/cli" "github.com/hashicorp/vault/api" + "github.com/hashicorp/vault/sdk/helper/roottoken" ) func testOperatorRekeyCommand(tb testing.TB) (*cli.MockUi, *OperatorRekeyCommand) { diff --git a/command/pgp_test.go b/command/pgp_test.go index 2211cbed56..df14d895f7 100644 --- a/command/pgp_test.go +++ b/command/pgp_test.go @@ -13,11 +13,10 @@ import ( "sort" "testing" - "github.com/hashicorp/vault/helper/pgpkeys" - "github.com/hashicorp/vault/vault" - "github.com/ProtonMail/go-crypto/openpgp" "github.com/ProtonMail/go-crypto/openpgp/packet" + "github.com/hashicorp/vault/helper/pgpkeys" + "github.com/hashicorp/vault/vault" ) func getPubKeyFiles(t *testing.T) (string, []string, error) { diff --git a/command/pki_health_check.go b/command/pki_health_check.go index 0ae44499fb..d70e3ecb0e 100644 --- a/command/pki_health_check.go +++ b/command/pki_health_check.go @@ -9,10 +9,9 @@ import ( "os" "strings" - "github.com/hashicorp/vault/command/healthcheck" - "github.com/ghodss/yaml" "github.com/hashicorp/cli" + "github.com/hashicorp/vault/command/healthcheck" "github.com/posener/complete" "github.com/ryanuber/columnize" ) diff --git a/command/pki_health_check_test.go b/command/pki_health_check_test.go index 5f86b3b97f..d63574a270 100644 --- a/command/pki_health_check_test.go +++ b/command/pki_health_check_test.go @@ -12,10 +12,9 @@ import ( "testing" "time" + "github.com/hashicorp/cli" "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/command/healthcheck" - - "github.com/hashicorp/cli" "github.com/stretchr/testify/require" ) diff --git a/command/pki_list_intermediate.go b/command/pki_list_intermediate.go index d756d610f1..7314e671bc 100644 --- a/command/pki_list_intermediate.go +++ b/command/pki_list_intermediate.go @@ -9,9 +9,8 @@ import ( "strconv" "strings" - "github.com/hashicorp/vault/api" - "github.com/ghodss/yaml" + "github.com/hashicorp/vault/api" "github.com/ryanuber/columnize" ) diff --git a/command/pki_reissue_intermediate.go b/command/pki_reissue_intermediate.go index cbaa657e7b..fa4dd38fbe 100644 --- a/command/pki_reissue_intermediate.go +++ b/command/pki_reissue_intermediate.go @@ -12,7 +12,6 @@ import ( "strings" "github.com/hashicorp/vault/sdk/helper/certutil" - "github.com/posener/complete" ) diff --git a/command/pki_verify_sign.go b/command/pki_verify_sign.go index 31d693e5ae..f6d8dc93cd 100644 --- a/command/pki_verify_sign.go +++ b/command/pki_verify_sign.go @@ -11,10 +11,9 @@ import ( "strconv" "strings" - "github.com/hashicorp/vault/command/healthcheck" - "github.com/ghodss/yaml" "github.com/hashicorp/vault/api" + "github.com/hashicorp/vault/command/healthcheck" "github.com/ryanuber/columnize" ) diff --git a/command/server/config_test_helpers.go b/command/server/config_test_helpers.go index cd5e161001..92f406aea9 100644 --- a/command/server/config_test_helpers.go +++ b/command/server/config_test_helpers.go @@ -11,13 +11,12 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "github.com/go-test/deep" "github.com/hashicorp/hcl" "github.com/hashicorp/hcl/hcl/ast" "github.com/hashicorp/hcl/hcl/token" "github.com/hashicorp/vault/internalshared/configutil" + "github.com/stretchr/testify/require" ) var DefaultCustomHeaders = map[string]map[string]string{ diff --git a/command/server/listener.go b/command/server/listener.go index c003a6289d..bdc2117d77 100644 --- a/command/server/listener.go +++ b/command/server/listener.go @@ -9,9 +9,6 @@ import ( "io" "net" - // We must import sha512 so that it registers with the runtime so that - // certificates that use it can be parsed. - "github.com/hashicorp/cli" "github.com/hashicorp/go-secure-stdlib/reloadutil" "github.com/hashicorp/vault/helper/proxyutil" diff --git a/command/transit_import_key.go b/command/transit_import_key.go index 350821b076..0c77f06674 100644 --- a/command/transit_import_key.go +++ b/command/transit_import_key.go @@ -16,11 +16,9 @@ import ( "regexp" "strings" - "github.com/hashicorp/vault/api" - "github.com/google/tink/go/kwp/subtle" - "github.com/hashicorp/cli" + "github.com/hashicorp/vault/api" "github.com/posener/complete" ) diff --git a/command/transit_import_key_test.go b/command/transit_import_key_test.go index 21884c0799..847ab59ff7 100644 --- a/command/transit_import_key_test.go +++ b/command/transit_import_key_test.go @@ -14,7 +14,6 @@ import ( "time" "github.com/hashicorp/vault/api" - "github.com/stretchr/testify/require" ) diff --git a/helper/builtinplugins/registry_test.go b/helper/builtinplugins/registry_test.go index 99bbd05e61..0602ec8bee 100644 --- a/helper/builtinplugins/registry_test.go +++ b/helper/builtinplugins/registry_test.go @@ -15,7 +15,6 @@ import ( "github.com/hashicorp/vault/helper/constants" dbMysql "github.com/hashicorp/vault/plugins/database/mysql" "github.com/hashicorp/vault/sdk/helper/consts" - "golang.org/x/exp/slices" ) diff --git a/helper/dhutil/dhutil.go b/helper/dhutil/dhutil.go index 364fc3c14a..7c14cb29fb 100644 --- a/helper/dhutil/dhutil.go +++ b/helper/dhutil/dhutil.go @@ -13,9 +13,8 @@ import ( "fmt" "io" - "golang.org/x/crypto/hkdf" - "golang.org/x/crypto/curve25519" + "golang.org/x/crypto/hkdf" ) type PublicKeyInfo struct { diff --git a/helper/fairshare/jobmanager.go b/helper/fairshare/jobmanager.go index 086a549f64..73a115644b 100644 --- a/helper/fairshare/jobmanager.go +++ b/helper/fairshare/jobmanager.go @@ -14,7 +14,6 @@ import ( "github.com/armon/go-metrics" log "github.com/hashicorp/go-hclog" uuid "github.com/hashicorp/go-uuid" - "github.com/hashicorp/vault/helper/metricsutil" "github.com/hashicorp/vault/sdk/helper/logging" ) diff --git a/helper/pkcs7/pkcs7.go b/helper/pkcs7/pkcs7.go index eecff9bc8e..69155692e3 100644 --- a/helper/pkcs7/pkcs7.go +++ b/helper/pkcs7/pkcs7.go @@ -7,14 +7,13 @@ import ( "crypto/dsa" "crypto/ecdsa" "crypto/rsa" + _ "crypto/sha1" // for crypto.SHA1 "crypto/x509" "crypto/x509/pkix" "encoding/asn1" "errors" "fmt" "sort" - - _ "crypto/sha1" // for crypto.SHA1 ) // PKCS7 Represents a PKCS7 structure diff --git a/helper/testhelpers/ldap/ldaphelper.go b/helper/testhelpers/ldap/ldaphelper.go index e206d10795..e428dffe22 100644 --- a/helper/testhelpers/ldap/ldaphelper.go +++ b/helper/testhelpers/ldap/ldaphelper.go @@ -11,7 +11,6 @@ import ( "testing" "github.com/hashicorp/cap/ldap" - "github.com/hashicorp/vault/sdk/helper/docker" "github.com/hashicorp/vault/sdk/helper/ldaputil" ) diff --git a/http/forwarding_test.go b/http/forwarding_test.go index c2fdfcb256..89606b24f2 100644 --- a/http/forwarding_test.go +++ b/http/forwarding_test.go @@ -17,8 +17,6 @@ import ( "testing" "time" - "golang.org/x/net/http2" - cleanhttp "github.com/hashicorp/go-cleanhttp" "github.com/hashicorp/vault/api" credCert "github.com/hashicorp/vault/builtin/credential/cert" @@ -27,6 +25,7 @@ import ( "github.com/hashicorp/vault/sdk/helper/keysutil" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/vault" + "golang.org/x/net/http2" ) func TestHTTP_Fallback_Bad_Address(t *testing.T) { diff --git a/http/handler_test.go b/http/handler_test.go index b27cff8679..ebfee04016 100644 --- a/http/handler_test.go +++ b/http/handler_test.go @@ -19,16 +19,15 @@ import ( "strings" "testing" - "github.com/hashicorp/vault/internalshared/configutil" - "github.com/stretchr/testify/require" - "github.com/go-test/deep" "github.com/hashicorp/go-cleanhttp" "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/helper/versions" + "github.com/hashicorp/vault/internalshared/configutil" "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/vault" + "github.com/stretchr/testify/require" ) func TestHandler_parseMFAHandler(t *testing.T) { diff --git a/http/logical_test.go b/http/logical_test.go index bd90ac4ea2..e07815896d 100644 --- a/http/logical_test.go +++ b/http/logical_test.go @@ -22,8 +22,10 @@ import ( log "github.com/hashicorp/go-hclog" kv "github.com/hashicorp/vault-plugin-secrets-kv" "github.com/hashicorp/vault/api" + "github.com/hashicorp/vault/audit" auditFile "github.com/hashicorp/vault/builtin/audit/file" credUserpass "github.com/hashicorp/vault/builtin/credential/userpass" + "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/helper/testhelpers/corehelpers" "github.com/hashicorp/vault/internalshared/configutil" "github.com/hashicorp/vault/sdk/framework" @@ -32,9 +34,6 @@ import ( "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/sdk/physical" "github.com/hashicorp/vault/sdk/physical/inmem" - - "github.com/hashicorp/vault/audit" - "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/vault" ) diff --git a/http/sys_metrics_test.go b/http/sys_metrics_test.go index 1198815a55..9500bff031 100644 --- a/http/sys_metrics_test.go +++ b/http/sys_metrics_test.go @@ -7,10 +7,9 @@ import ( "testing" "time" - "github.com/hashicorp/vault/helper/testhelpers/corehelpers" - "github.com/armon/go-metrics" "github.com/hashicorp/vault/helper/metricsutil" + "github.com/hashicorp/vault/helper/testhelpers/corehelpers" "github.com/hashicorp/vault/internalshared/configutil" "github.com/hashicorp/vault/vault" ) diff --git a/http/util.go b/http/util.go index 9293120cc0..88a94f413c 100644 --- a/http/util.go +++ b/http/util.go @@ -13,9 +13,8 @@ import ( "strings" "github.com/hashicorp/go-multierror" - "github.com/hashicorp/vault/sdk/logical" - "github.com/hashicorp/vault/helper/namespace" + "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/vault" "github.com/hashicorp/vault/vault/quotas" ) diff --git a/internal/observability/event/sink_file_test.go b/internal/observability/event/sink_file_test.go index 2aa76f9fe6..17f3b25a94 100644 --- a/internal/observability/event/sink_file_test.go +++ b/internal/observability/event/sink_file_test.go @@ -9,10 +9,8 @@ import ( "testing" "time" - "github.com/hashicorp/vault/helper/namespace" - "github.com/hashicorp/eventlogger" - + "github.com/hashicorp/vault/helper/namespace" "github.com/stretchr/testify/require" ) diff --git a/internalshared/configutil/telemetry.go b/internalshared/configutil/telemetry.go index 964e03f0b9..d00b922b75 100644 --- a/internalshared/configutil/telemetry.go +++ b/internalshared/configutil/telemetry.go @@ -9,8 +9,6 @@ import ( "fmt" "time" - "github.com/hashicorp/go-secure-stdlib/parseutil" - monitoring "cloud.google.com/go/monitoring/apiv3" "github.com/armon/go-metrics" "github.com/armon/go-metrics/circonus" @@ -20,6 +18,7 @@ import ( stackdrivervault "github.com/google/go-metrics-stackdriver/vault" "github.com/hashicorp/cli" "github.com/hashicorp/go-multierror" + "github.com/hashicorp/go-secure-stdlib/parseutil" "github.com/hashicorp/hcl" "github.com/hashicorp/hcl/hcl/ast" "github.com/hashicorp/vault/helper/metricsutil" diff --git a/physical/azure/azure_test.go b/physical/azure/azure_test.go index 97b2bbce88..13f4e301cd 100644 --- a/physical/azure/azure_test.go +++ b/physical/azure/azure_test.go @@ -12,10 +12,9 @@ import ( "testing" "time" - "github.com/hashicorp/vault/helper/testhelpers/azurite" - "github.com/Azure/azure-storage-blob-go/azblob" log "github.com/hashicorp/go-hclog" + "github.com/hashicorp/vault/helper/testhelpers/azurite" "github.com/hashicorp/vault/sdk/helper/logging" "github.com/hashicorp/vault/sdk/physical" ) diff --git a/physical/cockroachdb/cockroachdb.go b/physical/cockroachdb/cockroachdb.go index 3258ecb940..bf282e9ac6 100644 --- a/physical/cockroachdb/cockroachdb.go +++ b/physical/cockroachdb/cockroachdb.go @@ -19,8 +19,6 @@ import ( "github.com/hashicorp/go-multierror" "github.com/hashicorp/go-secure-stdlib/strutil" "github.com/hashicorp/vault/sdk/physical" - - // CockroachDB uses the Postgres SQL driver _ "github.com/jackc/pgx/v4/stdlib" ) diff --git a/physical/dynamodb/dynamodb.go b/physical/dynamodb/dynamodb.go index d89594885b..452b2f7fc3 100644 --- a/physical/dynamodb/dynamodb.go +++ b/physical/dynamodb/dynamodb.go @@ -18,21 +18,19 @@ import ( "sync/atomic" "time" - log "github.com/hashicorp/go-hclog" - metrics "github.com/armon/go-metrics" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" + "github.com/cenkalti/backoff/v3" cleanhttp "github.com/hashicorp/go-cleanhttp" + log "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-secure-stdlib/awsutil" uuid "github.com/hashicorp/go-uuid" "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/physical" - - "github.com/cenkalti/backoff/v3" ) const ( diff --git a/physical/dynamodb/dynamodb_test.go b/physical/dynamodb/dynamodb_test.go index 70a45d01f0..0d6bd5914f 100644 --- a/physical/dynamodb/dynamodb_test.go +++ b/physical/dynamodb/dynamodb_test.go @@ -15,17 +15,16 @@ import ( "testing" "time" - "github.com/go-test/deep" - log "github.com/hashicorp/go-hclog" - "github.com/hashicorp/vault/sdk/helper/docker" - "github.com/hashicorp/vault/sdk/helper/logging" - "github.com/hashicorp/vault/sdk/physical" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" + "github.com/go-test/deep" + log "github.com/hashicorp/go-hclog" + "github.com/hashicorp/vault/sdk/helper/docker" + "github.com/hashicorp/vault/sdk/helper/logging" + "github.com/hashicorp/vault/sdk/physical" ) func TestDynamoDBBackend(t *testing.T) { diff --git a/physical/foundationdb/foundationdb.go b/physical/foundationdb/foundationdb.go index b62e89da40..de706d1fa9 100644 --- a/physical/foundationdb/foundationdb.go +++ b/physical/foundationdb/foundationdb.go @@ -15,15 +15,13 @@ import ( "sync" "time" - log "github.com/hashicorp/go-hclog" - uuid "github.com/hashicorp/go-uuid" - "github.com/apple/foundationdb/bindings/go/src/fdb" "github.com/apple/foundationdb/bindings/go/src/fdb/directory" "github.com/apple/foundationdb/bindings/go/src/fdb/subspace" "github.com/apple/foundationdb/bindings/go/src/fdb/tuple" - metrics "github.com/armon/go-metrics" + log "github.com/hashicorp/go-hclog" + uuid "github.com/hashicorp/go-uuid" "github.com/hashicorp/vault/sdk/physical" ) diff --git a/physical/foundationdb/foundationdb_test.go b/physical/foundationdb/foundationdb_test.go index 2ced4742c0..8bbcbb3ed1 100644 --- a/physical/foundationdb/foundationdb_test.go +++ b/physical/foundationdb/foundationdb_test.go @@ -13,15 +13,12 @@ import ( "testing" "time" - log "github.com/hashicorp/go-hclog" - uuid "github.com/hashicorp/go-uuid" - "github.com/apple/foundationdb/bindings/go/src/fdb" "github.com/apple/foundationdb/bindings/go/src/fdb/directory" - + log "github.com/hashicorp/go-hclog" + uuid "github.com/hashicorp/go-uuid" "github.com/hashicorp/vault/sdk/helper/logging" "github.com/hashicorp/vault/sdk/physical" - dockertest "gopkg.in/ory-am/dockertest.v3" ) diff --git a/physical/foundationdb/foundationdbstub.go b/physical/foundationdb/foundationdbstub.go index d8669fb646..288e8f7acf 100644 --- a/physical/foundationdb/foundationdbstub.go +++ b/physical/foundationdb/foundationdbstub.go @@ -9,7 +9,6 @@ import ( "fmt" log "github.com/hashicorp/go-hclog" - "github.com/hashicorp/vault/sdk/physical" ) diff --git a/physical/mysql/mysql.go b/physical/mysql/mysql.go index 40d9611a9d..8c4b89e00c 100644 --- a/physical/mysql/mysql.go +++ b/physical/mysql/mysql.go @@ -20,11 +20,10 @@ import ( "time" "unicode" - log "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-multierror" - metrics "github.com/armon/go-metrics" mysql "github.com/go-sql-driver/mysql" + log "github.com/hashicorp/go-hclog" + "github.com/hashicorp/go-multierror" "github.com/hashicorp/go-secure-stdlib/strutil" "github.com/hashicorp/vault/sdk/physical" ) diff --git a/physical/mysql/mysql_test.go b/physical/mysql/mysql_test.go index 30d8372caa..419966df49 100644 --- a/physical/mysql/mysql_test.go +++ b/physical/mysql/mysql_test.go @@ -10,14 +10,12 @@ import ( "testing" "time" - log "github.com/hashicorp/go-hclog" - "github.com/hashicorp/vault/sdk/helper/logging" - "github.com/hashicorp/vault/sdk/physical" - _ "github.com/go-sql-driver/mysql" mysql "github.com/go-sql-driver/mysql" - + log "github.com/hashicorp/go-hclog" mysqlhelper "github.com/hashicorp/vault/helper/testhelpers/mysql" + "github.com/hashicorp/vault/sdk/helper/logging" + "github.com/hashicorp/vault/sdk/physical" ) func TestMySQLPlaintextCatch(t *testing.T) { diff --git a/physical/raft/chunking_test.go b/physical/raft/chunking_test.go index ad4188f595..0309cdacdf 100644 --- a/physical/raft/chunking_test.go +++ b/physical/raft/chunking_test.go @@ -15,7 +15,7 @@ import ( raftchunkingtypes "github.com/hashicorp/go-raftchunking/types" "github.com/hashicorp/go-uuid" "github.com/hashicorp/raft" - "github.com/hashicorp/raft-boltdb/v2" + raftboltdb "github.com/hashicorp/raft-boltdb/v2" "github.com/hashicorp/vault/sdk/physical" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/physical/swift/swift.go b/physical/swift/swift.go index b19b58bda8..8e53bd2fbe 100644 --- a/physical/swift/swift.go +++ b/physical/swift/swift.go @@ -12,10 +12,9 @@ import ( "strings" "time" - log "github.com/hashicorp/go-hclog" - metrics "github.com/armon/go-metrics" cleanhttp "github.com/hashicorp/go-cleanhttp" + log "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-secure-stdlib/strutil" "github.com/hashicorp/vault/sdk/physical" "github.com/ncw/swift" diff --git a/physical/swift/swift_test.go b/physical/swift/swift_test.go index a17b15515e..3f192cd3f4 100644 --- a/physical/swift/swift_test.go +++ b/physical/swift/swift_test.go @@ -9,9 +9,8 @@ import ( "testing" "time" - log "github.com/hashicorp/go-hclog" - cleanhttp "github.com/hashicorp/go-cleanhttp" + log "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/sdk/helper/logging" "github.com/hashicorp/vault/sdk/physical" "github.com/ncw/swift" diff --git a/plugins/database/cassandra/cassandra.go b/plugins/database/cassandra/cassandra.go index 01a4c406cb..7118e2b55b 100644 --- a/plugins/database/cassandra/cassandra.go +++ b/plugins/database/cassandra/cassandra.go @@ -8,13 +8,12 @@ import ( "fmt" "strings" - "github.com/hashicorp/vault/sdk/helper/template" - "github.com/gocql/gocql" multierror "github.com/hashicorp/go-multierror" "github.com/hashicorp/go-secure-stdlib/strutil" dbplugin "github.com/hashicorp/vault/sdk/database/dbplugin/v5" "github.com/hashicorp/vault/sdk/database/helper/dbutil" + "github.com/hashicorp/vault/sdk/helper/template" ) const ( diff --git a/plugins/database/cassandra/cassandra_test.go b/plugins/database/cassandra/cassandra_test.go index 9162c467a2..6382f89c7b 100644 --- a/plugins/database/cassandra/cassandra_test.go +++ b/plugins/database/cassandra/cassandra_test.go @@ -9,13 +9,12 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - backoff "github.com/cenkalti/backoff/v3" "github.com/gocql/gocql" "github.com/hashicorp/vault/helper/testhelpers/cassandra" dbplugin "github.com/hashicorp/vault/sdk/database/dbplugin/v5" dbtesting "github.com/hashicorp/vault/sdk/database/dbplugin/v5/testing" + "github.com/stretchr/testify/require" ) func getCassandra(t *testing.T, protocolVersion interface{}) (*Cassandra, func()) { diff --git a/plugins/database/mssql/mssql.go b/plugins/database/mssql/mssql.go index 33162dc407..833202b8d4 100644 --- a/plugins/database/mssql/mssql.go +++ b/plugins/database/mssql/mssql.go @@ -14,7 +14,6 @@ import ( "github.com/hashicorp/go-multierror" "github.com/hashicorp/go-secure-stdlib/parseutil" "github.com/hashicorp/go-secure-stdlib/strutil" - "github.com/hashicorp/vault/sdk/database/dbplugin/v5" "github.com/hashicorp/vault/sdk/database/helper/connutil" "github.com/hashicorp/vault/sdk/database/helper/dbutil" diff --git a/plugins/database/mysql/mysql_test.go b/plugins/database/mysql/mysql_test.go index 4507b91a2a..72c2a125a5 100644 --- a/plugins/database/mysql/mysql_test.go +++ b/plugins/database/mysql/mysql_test.go @@ -14,14 +14,13 @@ import ( stdmysql "github.com/go-sql-driver/mysql" "github.com/hashicorp/go-secure-stdlib/strutil" - "github.com/stretchr/testify/require" - mysqlhelper "github.com/hashicorp/vault/helper/testhelpers/mysql" "github.com/hashicorp/vault/sdk/database/dbplugin/v5" dbtesting "github.com/hashicorp/vault/sdk/database/dbplugin/v5/testing" "github.com/hashicorp/vault/sdk/database/helper/connutil" "github.com/hashicorp/vault/sdk/database/helper/credsutil" "github.com/hashicorp/vault/sdk/database/helper/dbutil" + "github.com/stretchr/testify/require" ) var _ dbplugin.Database = (*MySQL)(nil) diff --git a/plugins/database/postgresql/postgresql_test.go b/plugins/database/postgresql/postgresql_test.go index 6421568d2a..90184e10a3 100644 --- a/plugins/database/postgresql/postgresql_test.go +++ b/plugins/database/postgresql/postgresql_test.go @@ -12,17 +12,15 @@ import ( "testing" "time" - "github.com/hashicorp/vault/sdk/database/helper/connutil" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/hashicorp/vault/helper/testhelpers/postgresql" "github.com/hashicorp/vault/sdk/database/dbplugin/v5" dbtesting "github.com/hashicorp/vault/sdk/database/dbplugin/v5/testing" + "github.com/hashicorp/vault/sdk/database/helper/connutil" "github.com/hashicorp/vault/sdk/database/helper/dbutil" "github.com/hashicorp/vault/sdk/helper/docker" "github.com/hashicorp/vault/sdk/helper/template" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func getPostgreSQL(t *testing.T, options map[string]interface{}) (*PostgreSQL, func()) { diff --git a/sdk/database/dbplugin/grpc_transport.go b/sdk/database/dbplugin/grpc_transport.go index 3740ef59c3..456be812d2 100644 --- a/sdk/database/dbplugin/grpc_transport.go +++ b/sdk/database/dbplugin/grpc_transport.go @@ -9,12 +9,11 @@ import ( "errors" "time" + "github.com/golang/protobuf/ptypes" + "github.com/hashicorp/vault/sdk/helper/pluginutil" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - - "github.com/golang/protobuf/ptypes" - "github.com/hashicorp/vault/sdk/helper/pluginutil" ) var ( diff --git a/sdk/database/dbplugin/plugin.go b/sdk/database/dbplugin/plugin.go index 0b01454123..5b9aaae0ae 100644 --- a/sdk/database/dbplugin/plugin.go +++ b/sdk/database/dbplugin/plugin.go @@ -8,13 +8,12 @@ import ( "fmt" "time" - "google.golang.org/grpc" - "github.com/hashicorp/errwrap" log "github.com/hashicorp/go-hclog" plugin "github.com/hashicorp/go-plugin" "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/helper/pluginutil" + "google.golang.org/grpc" ) // Database is the interface that all database objects must implement. diff --git a/sdk/database/dbplugin/v5/grpc_server_test.go b/sdk/database/dbplugin/v5/grpc_server_test.go index 53d44c7c2a..847a9e770d 100644 --- a/sdk/database/dbplugin/v5/grpc_server_test.go +++ b/sdk/database/dbplugin/v5/grpc_server_test.go @@ -11,16 +11,15 @@ import ( "testing" "time" - "github.com/hashicorp/vault/sdk/logical" - "google.golang.org/protobuf/types/known/structpb" - "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/timestamp" "github.com/hashicorp/vault/sdk/database/dbplugin/v5/proto" "github.com/hashicorp/vault/sdk/helper/pluginutil" + "github.com/hashicorp/vault/sdk/logical" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/structpb" ) // Before minValidSeconds in ptypes package diff --git a/sdk/framework/backend.go b/sdk/framework/backend.go index a16228eabb..09a3f85b2d 100644 --- a/sdk/framework/backend.go +++ b/sdk/framework/backend.go @@ -18,11 +18,10 @@ import ( "sync" "time" - "github.com/hashicorp/go-kms-wrapping/entropy/v2" - jsonpatch "github.com/evanphx/json-patch/v5" "github.com/hashicorp/errwrap" log "github.com/hashicorp/go-hclog" + "github.com/hashicorp/go-kms-wrapping/entropy/v2" "github.com/hashicorp/go-multierror" "github.com/hashicorp/go-secure-stdlib/parseutil" "github.com/hashicorp/vault/sdk/helper/consts" diff --git a/sdk/framework/backend_test.go b/sdk/framework/backend_test.go index 0b7a205437..dba5b0c0a3 100644 --- a/sdk/framework/backend_test.go +++ b/sdk/framework/backend_test.go @@ -14,7 +14,6 @@ import ( "time" "github.com/hashicorp/go-secure-stdlib/strutil" - "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/logical" "github.com/stretchr/testify/require" diff --git a/sdk/helper/custommetadata/custom_metadata.go b/sdk/helper/custommetadata/custom_metadata.go index 81d4c27035..d33370b510 100644 --- a/sdk/helper/custommetadata/custom_metadata.go +++ b/sdk/helper/custommetadata/custom_metadata.go @@ -6,10 +6,9 @@ package custommetadata import ( "fmt" - "github.com/mitchellh/mapstructure" - "github.com/hashicorp/go-multierror" "github.com/hashicorp/go-secure-stdlib/strutil" + "github.com/mitchellh/mapstructure" ) // The following constants are used by Validate and are meant to be imposed diff --git a/sdk/helper/keysutil/policy.go b/sdk/helper/keysutil/policy.go index f70d4497e0..6b9caad9ca 100644 --- a/sdk/helper/keysutil/policy.go +++ b/sdk/helper/keysutil/policy.go @@ -32,18 +32,16 @@ import ( "sync/atomic" "time" - "golang.org/x/crypto/chacha20poly1305" - "golang.org/x/crypto/ed25519" - "golang.org/x/crypto/hkdf" - + "github.com/google/tink/go/kwp/subtle" "github.com/hashicorp/errwrap" "github.com/hashicorp/go-uuid" "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/helper/jsonutil" "github.com/hashicorp/vault/sdk/helper/kdf" "github.com/hashicorp/vault/sdk/logical" - - "github.com/google/tink/go/kwp/subtle" + "golang.org/x/crypto/chacha20poly1305" + "golang.org/x/crypto/ed25519" + "golang.org/x/crypto/hkdf" ) // Careful with iota; don't put anything before it in this const block because diff --git a/sdk/helper/keysutil/policy_test.go b/sdk/helper/keysutil/policy_test.go index f5e4d35eb8..487804b719 100644 --- a/sdk/helper/keysutil/policy_test.go +++ b/sdk/helper/keysutil/policy_test.go @@ -21,12 +21,11 @@ import ( "testing" "time" - "golang.org/x/crypto/ed25519" - "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/helper/jsonutil" "github.com/hashicorp/vault/sdk/logical" "github.com/mitchellh/copystructure" + "golang.org/x/crypto/ed25519" ) func TestPolicy_KeyEntryMapUpgrade(t *testing.T) { diff --git a/sdk/helper/ldaputil/config.go b/sdk/helper/ldaputil/config.go index 84c6d7ec62..6e317d7a51 100644 --- a/sdk/helper/ldaputil/config.go +++ b/sdk/helper/ldaputil/config.go @@ -12,14 +12,11 @@ import ( "strings" "text/template" - capldap "github.com/hashicorp/cap/ldap" - "github.com/hashicorp/go-secure-stdlib/tlsutil" - - "github.com/hashicorp/vault/sdk/framework" - - "github.com/hashicorp/errwrap" - "github.com/go-ldap/ldap/v3" + capldap "github.com/hashicorp/cap/ldap" + "github.com/hashicorp/errwrap" + "github.com/hashicorp/go-secure-stdlib/tlsutil" + "github.com/hashicorp/vault/sdk/framework" ) var ldapDerefAliasMap = map[string]int{ diff --git a/sdk/helper/pluginidentityutil/fields_test.go b/sdk/helper/pluginidentityutil/fields_test.go index 96c844971d..a64f1aca43 100644 --- a/sdk/helper/pluginidentityutil/fields_test.go +++ b/sdk/helper/pluginidentityutil/fields_test.go @@ -7,9 +7,8 @@ import ( "testing" "time" - "github.com/stretchr/testify/assert" - "github.com/hashicorp/vault/sdk/framework" + "github.com/stretchr/testify/assert" ) const ( diff --git a/sdk/logical/testing.go b/sdk/logical/testing.go index a173c7c5f7..d379561930 100644 --- a/sdk/logical/testing.go +++ b/sdk/logical/testing.go @@ -8,10 +8,9 @@ import ( "reflect" "time" - testing "github.com/mitchellh/go-testing-interface" - log "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/sdk/helper/logging" + testing "github.com/mitchellh/go-testing-interface" ) // TestRequest is a helper to create a purely in-memory Request struct. diff --git a/sdk/physical/file/file.go b/sdk/physical/file/file.go index d7ad9de3a2..6e9778ce91 100644 --- a/sdk/physical/file/file.go +++ b/sdk/physical/file/file.go @@ -17,7 +17,6 @@ import ( "github.com/hashicorp/errwrap" log "github.com/hashicorp/go-hclog" - "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/helper/jsonutil" "github.com/hashicorp/vault/sdk/physical" diff --git a/sdk/plugin/backend.go b/sdk/plugin/backend.go index 2da1378eaa..7ee591657c 100644 --- a/sdk/plugin/backend.go +++ b/sdk/plugin/backend.go @@ -7,13 +7,12 @@ import ( "context" "sync/atomic" - "google.golang.org/grpc" - log "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-plugin" "github.com/hashicorp/vault/sdk/helper/pluginutil" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/sdk/plugin/pb" + "google.golang.org/grpc" ) var ( diff --git a/sdk/plugin/grpc_backend_server.go b/sdk/plugin/grpc_backend_server.go index cdc19b604c..b537d41bb5 100644 --- a/sdk/plugin/grpc_backend_server.go +++ b/sdk/plugin/grpc_backend_server.go @@ -9,9 +9,8 @@ import ( "fmt" "sync" - "github.com/hashicorp/go-plugin" - log "github.com/hashicorp/go-hclog" + "github.com/hashicorp/go-plugin" "github.com/hashicorp/vault/sdk/helper/pluginutil" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/sdk/plugin/pb" diff --git a/sdk/plugin/grpc_storage.go b/sdk/plugin/grpc_storage.go index 5c2f0de3f4..638f4b0dd7 100644 --- a/sdk/plugin/grpc_storage.go +++ b/sdk/plugin/grpc_storage.go @@ -7,10 +7,9 @@ import ( "context" "errors" - "google.golang.org/grpc" - "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/sdk/plugin/pb" + "google.golang.org/grpc" ) var errMissingStorage = errors.New("missing storage implementation: this method should not be called during plugin Setup, but only during and after Initialize") diff --git a/sdk/plugin/serve.go b/sdk/plugin/serve.go index 37e0c729a5..2fe4af2686 100644 --- a/sdk/plugin/serve.go +++ b/sdk/plugin/serve.go @@ -8,12 +8,11 @@ import ( "math" "os" - "google.golang.org/grpc" - log "github.com/hashicorp/go-hclog" plugin "github.com/hashicorp/go-plugin" "github.com/hashicorp/vault/sdk/helper/pluginutil" "github.com/hashicorp/vault/sdk/logical" + "google.golang.org/grpc" ) // BackendPluginName is the name of the plugin that can be diff --git a/sdk/plugin/storage_test.go b/sdk/plugin/storage_test.go index 61a5deec67..f36a6221ab 100644 --- a/sdk/plugin/storage_test.go +++ b/sdk/plugin/storage_test.go @@ -7,11 +7,10 @@ import ( "context" "testing" - "google.golang.org/grpc" - "github.com/hashicorp/go-plugin" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/sdk/plugin/pb" + "google.golang.org/grpc" ) func TestStorage_GRPC_ReturnsErrIfStorageNil(t *testing.T) { diff --git a/serviceregistration/consul/consul_service_registration_test.go b/serviceregistration/consul/consul_service_registration_test.go index 20bc764bed..bd41890be8 100644 --- a/serviceregistration/consul/consul_service_registration_test.go +++ b/serviceregistration/consul/consul_service_registration_test.go @@ -10,8 +10,6 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "github.com/go-test/deep" "github.com/hashicorp/consul/api" log "github.com/hashicorp/go-hclog" @@ -21,6 +19,7 @@ import ( "github.com/hashicorp/vault/sdk/physical/inmem" sr "github.com/hashicorp/vault/serviceregistration" "github.com/hashicorp/vault/vault" + "github.com/stretchr/testify/require" ) type consulConf map[string]string diff --git a/tools/tools.sh b/tools/tools.sh index d9ceeece6b..3b983dc4ef 100755 --- a/tools/tools.sh +++ b/tools/tools.sh @@ -46,6 +46,7 @@ install_external() { gotest.tools/gotestsum@latest honnef.co/go/tools/cmd/staticcheck@latest mvdan.cc/gofumpt@latest + github.com/rinchsan/gosimports/cmd/gosimports@latest ) echo "==> Installing external tools..." @@ -72,6 +73,7 @@ check_external() { protoc-go-inject-tag revgrep staticcheck + gosimports ) echo "==> Checking for external tools..." diff --git a/vault/acme_billing_system_view.go b/vault/acme_billing_system_view.go index d5b157b121..eb805cc2e7 100644 --- a/vault/acme_billing_system_view.go +++ b/vault/acme_billing_system_view.go @@ -12,9 +12,8 @@ import ( "strings" "time" - "github.com/hashicorp/vault/sdk/logical" - "github.com/hashicorp/go-kms-wrapping/entropy/v2" + "github.com/hashicorp/vault/sdk/logical" ) // See comment in command/format.go diff --git a/vault/auth_test.go b/vault/auth_test.go index d07c83c203..97b8287f88 100644 --- a/vault/auth_test.go +++ b/vault/auth_test.go @@ -10,11 +10,10 @@ import ( "testing" "time" - "github.com/hashicorp/vault/helper/testhelpers/corehelpers" - "github.com/armon/go-metrics" "github.com/hashicorp/vault/helper/metricsutil" "github.com/hashicorp/vault/helper/namespace" + "github.com/hashicorp/vault/helper/testhelpers/corehelpers" "github.com/hashicorp/vault/helper/versions" "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/helper/jsonutil" diff --git a/vault/cluster/cluster.go b/vault/cluster/cluster.go index ed77acba1e..8385d63a4c 100644 --- a/vault/cluster/cluster.go +++ b/vault/cluster/cluster.go @@ -18,11 +18,10 @@ import ( "sync/atomic" "time" - "github.com/hashicorp/vault/sdk/helper/certutil" - "github.com/hashicorp/vault/sdk/helper/tlsutil" - log "github.com/hashicorp/go-hclog" + "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/helper/consts" + "github.com/hashicorp/vault/sdk/helper/tlsutil" "golang.org/x/net/http2" ) diff --git a/vault/core_metrics_test.go b/vault/core_metrics_test.go index 3a8eeefffc..767b2ac3e3 100644 --- a/vault/core_metrics_test.go +++ b/vault/core_metrics_test.go @@ -12,12 +12,11 @@ import ( "testing" "time" - "github.com/stretchr/testify/assert" - "github.com/armon/go-metrics" logicalKv "github.com/hashicorp/vault-plugin-secrets-kv" "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/sdk/logical" + "github.com/stretchr/testify/assert" ) func TestCoreMetrics_KvSecretGauge(t *testing.T) { diff --git a/vault/core_test.go b/vault/core_test.go index c3cf000206..789071b787 100644 --- a/vault/core_test.go +++ b/vault/core_test.go @@ -14,26 +14,19 @@ import ( "testing" "time" - "github.com/hashicorp/vault/command/server" - - logicalKv "github.com/hashicorp/vault-plugin-secrets-kv" - logicalDb "github.com/hashicorp/vault/builtin/logical/database" - - "github.com/hashicorp/vault/builtin/plugin" - - "github.com/hashicorp/vault/builtin/audit/syslog" - - "github.com/hashicorp/vault/builtin/audit/file" - "github.com/hashicorp/vault/builtin/audit/socket" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/go-test/deep" "github.com/hashicorp/errwrap" log "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-secure-stdlib/strutil" "github.com/hashicorp/go-uuid" + logicalKv "github.com/hashicorp/vault-plugin-secrets-kv" "github.com/hashicorp/vault/audit" + "github.com/hashicorp/vault/builtin/audit/file" + "github.com/hashicorp/vault/builtin/audit/socket" + "github.com/hashicorp/vault/builtin/audit/syslog" + logicalDb "github.com/hashicorp/vault/builtin/logical/database" + "github.com/hashicorp/vault/builtin/plugin" + "github.com/hashicorp/vault/command/server" "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/helper/testhelpers/corehelpers" "github.com/hashicorp/vault/internalshared/configutil" @@ -46,6 +39,8 @@ import ( "github.com/hashicorp/vault/vault/seal" "github.com/hashicorp/vault/version" "github.com/sasha-s/go-deadlock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) // invalidKey is used to test Unseal diff --git a/vault/diagnose/output.go b/vault/diagnose/output.go index c6d0bde85b..46d1e1ea5b 100644 --- a/vault/diagnose/output.go +++ b/vault/diagnose/output.go @@ -13,9 +13,8 @@ import ( "sync" "time" - "go.opentelemetry.io/otel/attribute" - wordwrap "github.com/mitchellh/go-wordwrap" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/trace" diff --git a/vault/external_tests/api/kv_test.go b/vault/external_tests/api/kv_test.go index a54ccf0271..71eecdeedf 100644 --- a/vault/external_tests/api/kv_test.go +++ b/vault/external_tests/api/kv_test.go @@ -8,19 +8,13 @@ import ( "testing" kv "github.com/hashicorp/vault-plugin-secrets-kv" - "github.com/hashicorp/vault/sdk/logical" - - "github.com/hashicorp/vault/helper/testhelpers" - - vaulthttp "github.com/hashicorp/vault/http" - - "github.com/hashicorp/vault/vault" - - "github.com/hashicorp/vault/helper/testhelpers/minimal" - - "github.com/stretchr/testify/require" - "github.com/hashicorp/vault/api" + "github.com/hashicorp/vault/helper/testhelpers" + "github.com/hashicorp/vault/helper/testhelpers/minimal" + vaulthttp "github.com/hashicorp/vault/http" + "github.com/hashicorp/vault/sdk/logical" + "github.com/hashicorp/vault/vault" + "github.com/stretchr/testify/require" ) // TestKVV1Get tests an end-to-end KVV1 get, and checks the response diff --git a/vault/external_tests/api/sys_rekey_ext_test.go b/vault/external_tests/api/sys_rekey_ext_test.go index 2661987f14..fc8c0ddd83 100644 --- a/vault/external_tests/api/sys_rekey_ext_test.go +++ b/vault/external_tests/api/sys_rekey_ext_test.go @@ -9,7 +9,6 @@ import ( "testing" "github.com/hashicorp/go-hclog" - "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/helper/testhelpers" vaulthttp "github.com/hashicorp/vault/http" diff --git a/vault/external_tests/metrics/core_metrics_int_test.go b/vault/external_tests/metrics/core_metrics_int_test.go index d70e10e89f..7a9005ed9b 100644 --- a/vault/external_tests/metrics/core_metrics_int_test.go +++ b/vault/external_tests/metrics/core_metrics_int_test.go @@ -11,10 +11,9 @@ import ( "testing" "time" - "github.com/hashicorp/vault/helper/testhelpers/corehelpers" - "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/helper/testhelpers" + "github.com/hashicorp/vault/helper/testhelpers/corehelpers" vaulthttp "github.com/hashicorp/vault/http" "github.com/hashicorp/vault/vault" ) diff --git a/vault/external_tests/mfa/login_mfa_test.go b/vault/external_tests/mfa/login_mfa_test.go index 13c1a1a2a9..5e99fad8ee 100644 --- a/vault/external_tests/mfa/login_mfa_test.go +++ b/vault/external_tests/mfa/login_mfa_test.go @@ -8,11 +8,10 @@ import ( "strings" "testing" - "github.com/hashicorp/vault/helper/testhelpers/minimal" - "github.com/hashicorp/go-secure-stdlib/strutil" "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/builtin/credential/userpass" + "github.com/hashicorp/vault/helper/testhelpers/minimal" vaulthttp "github.com/hashicorp/vault/http" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/vault" diff --git a/vault/external_tests/misc/misc_binary/recovery_test.go b/vault/external_tests/misc/misc_binary/recovery_test.go index 6aaecffcad..00e5570c30 100644 --- a/vault/external_tests/misc/misc_binary/recovery_test.go +++ b/vault/external_tests/misc/misc_binary/recovery_test.go @@ -9,12 +9,11 @@ import ( "path" "testing" - "github.com/mitchellh/mapstructure" - "github.com/go-test/deep" "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/sdk/helper/testcluster" "github.com/hashicorp/vault/sdk/helper/testcluster/docker" + "github.com/mitchellh/mapstructure" ) // TestRecovery_Docker exercises recovery mode. It starts a single node raft diff --git a/vault/external_tests/plugin/external_plugin_test.go b/vault/external_tests/plugin/external_plugin_test.go index 83d1d477fa..837d32f8a8 100644 --- a/vault/external_tests/plugin/external_plugin_test.go +++ b/vault/external_tests/plugin/external_plugin_test.go @@ -12,11 +12,10 @@ import ( "testing" "time" - "github.com/hashicorp/vault/audit" - auditFile "github.com/hashicorp/vault/builtin/audit/file" - "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/api/auth/approle" + "github.com/hashicorp/vault/audit" + auditFile "github.com/hashicorp/vault/builtin/audit/file" "github.com/hashicorp/vault/builtin/logical/database" "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/helper/testhelpers/consul" @@ -28,7 +27,6 @@ import ( "github.com/hashicorp/vault/sdk/helper/pluginutil" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/vault" - _ "github.com/jackc/pgx/v4/stdlib" ) diff --git a/vault/external_tests/quotas/quotas_test.go b/vault/external_tests/quotas/quotas_test.go index 93ca71a797..619e98f28b 100644 --- a/vault/external_tests/quotas/quotas_test.go +++ b/vault/external_tests/quotas/quotas_test.go @@ -9,14 +9,13 @@ import ( "time" "github.com/hashicorp/vault/api" - "github.com/hashicorp/vault/sdk/helper/testhelpers/schema" - "github.com/hashicorp/vault/sdk/logical" - "github.com/stretchr/testify/require" - "github.com/hashicorp/vault/builtin/credential/userpass" "github.com/hashicorp/vault/builtin/logical/pki" "github.com/hashicorp/vault/helper/testhelpers/teststorage" + "github.com/hashicorp/vault/sdk/helper/testhelpers/schema" + "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/vault" + "github.com/stretchr/testify/require" "go.uber.org/atomic" ) diff --git a/vault/external_tests/replication_binary/replication_test.go b/vault/external_tests/replication_binary/replication_test.go index 9f8a88d096..ff2ef3e2d8 100644 --- a/vault/external_tests/replication_binary/replication_test.go +++ b/vault/external_tests/replication_binary/replication_test.go @@ -8,11 +8,10 @@ Example of how to use docker.NewReplicationSetDocker(t), assuming you point VAULT_BINARY to an Enterprise Vault binary: import ( - "context" - "testing" - "time" - "github.com/hashicorp/vault/sdk/helper/testcluster/docker" + + + ) // TestStandardPerfReplication_Docker tests that we can create two 3-node diff --git a/vault/external_tests/router/router_ext_test.go b/vault/external_tests/router/router_ext_test.go index 73d335784b..c2cb58c4c3 100644 --- a/vault/external_tests/router/router_ext_test.go +++ b/vault/external_tests/router/router_ext_test.go @@ -9,14 +9,12 @@ import ( "strings" "testing" - "github.com/hashicorp/vault/audit" - "github.com/hashicorp/vault/helper/testhelpers/corehelpers" - - "github.com/hashicorp/vault/helper/testhelpers" - vaulthttp "github.com/hashicorp/vault/http" - "github.com/hashicorp/vault/api" + "github.com/hashicorp/vault/audit" + "github.com/hashicorp/vault/helper/testhelpers" + "github.com/hashicorp/vault/helper/testhelpers/corehelpers" "github.com/hashicorp/vault/helper/testhelpers/minimal" + vaulthttp "github.com/hashicorp/vault/http" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/vault" ) diff --git a/vault/external_tests/sealmigration/testshared.go b/vault/external_tests/sealmigration/testshared.go index f6ec26ddf2..7ddc36552e 100644 --- a/vault/external_tests/sealmigration/testshared.go +++ b/vault/external_tests/sealmigration/testshared.go @@ -13,7 +13,6 @@ import ( "github.com/go-test/deep" "github.com/hashicorp/go-hclog" wrapping "github.com/hashicorp/go-kms-wrapping/v2" - "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/helper/testhelpers" diff --git a/vault/identity_store_entities.go b/vault/identity_store_entities.go index 6094339c4e..2f3825d2dd 100644 --- a/vault/identity_store_entities.go +++ b/vault/identity_store_entities.go @@ -9,10 +9,9 @@ import ( "fmt" "strings" - "github.com/hashicorp/go-multierror" - "github.com/golang/protobuf/ptypes" memdb "github.com/hashicorp/go-memdb" + "github.com/hashicorp/go-multierror" "github.com/hashicorp/go-secure-stdlib/strutil" "github.com/hashicorp/vault/helper/identity" "github.com/hashicorp/vault/helper/identity/mfa" diff --git a/vault/identity_store_test.go b/vault/identity_store_test.go index bfd966e183..d706f31a8a 100644 --- a/vault/identity_store_test.go +++ b/vault/identity_store_test.go @@ -9,8 +9,6 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "github.com/armon/go-metrics" "github.com/go-test/deep" "github.com/golang/protobuf/ptypes" @@ -21,6 +19,7 @@ import ( "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/helper/storagepacker" "github.com/hashicorp/vault/sdk/logical" + "github.com/stretchr/testify/require" ) func TestIdentityStore_DeleteEntityAlias(t *testing.T) { diff --git a/vault/init.go b/vault/init.go index 8a76bb3400..28ff057437 100644 --- a/vault/init.go +++ b/vault/init.go @@ -12,12 +12,11 @@ import ( "net/url" "sync/atomic" - "github.com/hashicorp/vault/physical/raft" - "github.com/hashicorp/vault/vault/seal" - "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/helper/pgpkeys" + "github.com/hashicorp/vault/physical/raft" "github.com/hashicorp/vault/shamir" + "github.com/hashicorp/vault/vault/seal" ) // InitParams keeps the init function from being littered with too many diff --git a/vault/logical_system_quotas.go b/vault/logical_system_quotas.go index da7d65ed3e..bea528e547 100644 --- a/vault/logical_system_quotas.go +++ b/vault/logical_system_quotas.go @@ -11,10 +11,9 @@ import ( "time" "github.com/hashicorp/go-secure-stdlib/strutil" + "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/logical" - - "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/vault/quotas" ) diff --git a/vault/plugin_reload.go b/vault/plugin_reload.go index 5991469263..88d7d29610 100644 --- a/vault/plugin_reload.go +++ b/vault/plugin_reload.go @@ -8,10 +8,9 @@ import ( "fmt" "strings" - "github.com/hashicorp/vault/helper/namespace" - "github.com/hashicorp/go-multierror" "github.com/hashicorp/go-secure-stdlib/strutil" + "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/sdk/plugin" diff --git a/vault/plugincatalog/plugin_catalog_test.go b/vault/plugincatalog/plugin_catalog_test.go index 778ae74800..ceffabf00e 100644 --- a/vault/plugincatalog/plugin_catalog_test.go +++ b/vault/plugincatalog/plugin_catalog_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/go-version" "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/builtin/credential/userpass" + "github.com/hashicorp/vault/helper/builtinplugins" "github.com/hashicorp/vault/helper/testhelpers/corehelpers" "github.com/hashicorp/vault/helper/testhelpers/pluginhelpers" "github.com/hashicorp/vault/helper/versions" @@ -36,8 +37,6 @@ import ( "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/sdk/physical/inmem" backendplugin "github.com/hashicorp/vault/sdk/plugin" - - "github.com/hashicorp/vault/helper/builtinplugins" ) func testPluginCatalog(t *testing.T) *PluginCatalog { diff --git a/vault/plugincatalog/plugin_runtime_catalog.go b/vault/plugincatalog/plugin_runtime_catalog.go index ed64a67f32..73e7e01fe2 100644 --- a/vault/plugincatalog/plugin_runtime_catalog.go +++ b/vault/plugincatalog/plugin_runtime_catalog.go @@ -12,7 +12,6 @@ import ( "sync" log "github.com/hashicorp/go-hclog" - "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/helper/jsonutil" "github.com/hashicorp/vault/sdk/helper/pluginruntimeutil" diff --git a/vault/quotas/quotas_util.go b/vault/quotas/quotas_util.go index 8f2f82ac4a..728a82e8b2 100644 --- a/vault/quotas/quotas_util.go +++ b/vault/quotas/quotas_util.go @@ -9,9 +9,8 @@ import ( "context" log "github.com/hashicorp/go-hclog" - "github.com/hashicorp/vault/helper/metricsutil" - "github.com/hashicorp/go-memdb" + "github.com/hashicorp/vault/helper/metricsutil" ) func quotaTypes() []string { diff --git a/vault/rekey.go b/vault/rekey.go index 4a199bb7fb..1f254eb0d7 100644 --- a/vault/rekey.go +++ b/vault/rekey.go @@ -13,7 +13,6 @@ import ( "net/http" aeadwrapper "github.com/hashicorp/go-kms-wrapping/wrappers/aead/v2" - "github.com/hashicorp/go-uuid" "github.com/hashicorp/vault/helper/pgpkeys" "github.com/hashicorp/vault/sdk/helper/consts" diff --git a/vault/rekey_test.go b/vault/rekey_test.go index a7278b037f..246042ea89 100644 --- a/vault/rekey_test.go +++ b/vault/rekey_test.go @@ -11,7 +11,6 @@ import ( "testing" log "github.com/hashicorp/go-hclog" - "github.com/hashicorp/vault/sdk/helper/logging" "github.com/hashicorp/vault/sdk/physical" "github.com/hashicorp/vault/sdk/physical/inmem" diff --git a/vault/router_test.go b/vault/router_test.go index d6a3c0ec66..8f44afeaa9 100644 --- a/vault/router_test.go +++ b/vault/router_test.go @@ -9,11 +9,10 @@ import ( "strings" "testing" - "github.com/stretchr/testify/assert" - "github.com/hashicorp/go-uuid" "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/sdk/logical" + "github.com/stretchr/testify/assert" ) func TestRouter_Mount(t *testing.T) { diff --git a/vault/seal.go b/vault/seal.go index 19c6e25cfb..0bc9cebf53 100644 --- a/vault/seal.go +++ b/vault/seal.go @@ -11,10 +11,8 @@ import ( "sync/atomic" "github.com/hashicorp/vault/command/server" - "github.com/hashicorp/vault/sdk/helper/jsonutil" "github.com/hashicorp/vault/sdk/physical" - "github.com/hashicorp/vault/vault/seal" ) diff --git a/vault/seal/seal_test.go b/vault/seal/seal_test.go index 7556243182..76a02d9a27 100644 --- a/vault/seal/seal_test.go +++ b/vault/seal/seal_test.go @@ -8,9 +8,8 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/require" - wrapping "github.com/hashicorp/go-kms-wrapping/v2" + "github.com/stretchr/testify/require" ) func Test_keyIdSet(t *testing.T) { diff --git a/vault/seal/seal_testing.go b/vault/seal/seal_testing.go index 55608b9c2a..1a2d586b43 100644 --- a/vault/seal/seal_testing.go +++ b/vault/seal/seal_testing.go @@ -8,12 +8,10 @@ import ( "fmt" "sync" - UUID "github.com/hashicorp/go-uuid" - - "github.com/hashicorp/vault/sdk/helper/logging" - "github.com/hashicorp/go-hclog" wrapping "github.com/hashicorp/go-kms-wrapping/v2" + UUID "github.com/hashicorp/go-uuid" + "github.com/hashicorp/vault/sdk/helper/logging" ) type TestSealOpts struct { diff --git a/vault/seal_autoseal.go b/vault/seal_autoseal.go index a1613526c8..c3edf9d8a0 100644 --- a/vault/seal_autoseal.go +++ b/vault/seal_autoseal.go @@ -12,7 +12,6 @@ import ( "time" "github.com/armon/go-metrics" - log "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/sdk/physical" "github.com/hashicorp/vault/vault/seal" diff --git a/vault/seal_autoseal_test.go b/vault/seal_autoseal_test.go index e070471a35..223194d543 100644 --- a/vault/seal_autoseal_test.go +++ b/vault/seal_autoseal_test.go @@ -11,15 +11,12 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - - wrapping "github.com/hashicorp/go-kms-wrapping/v2" - "github.com/armon/go-metrics" + wrapping "github.com/hashicorp/go-kms-wrapping/v2" "github.com/hashicorp/vault/helper/metricsutil" - "github.com/hashicorp/vault/sdk/physical" "github.com/hashicorp/vault/vault/seal" + "github.com/stretchr/testify/require" ) // phy implements physical.Backend. It maps keys to a slice of entries. diff --git a/vault/seal_util_test.go b/vault/seal_util_test.go index b9afeb16f4..efbaeb428c 100644 --- a/vault/seal_util_test.go +++ b/vault/seal_util_test.go @@ -7,10 +7,9 @@ import ( "fmt" "testing" - "github.com/hashicorp/vault/vault/seal" - "github.com/golang/protobuf/proto" wrapping "github.com/hashicorp/go-kms-wrapping/v2" + "github.com/hashicorp/vault/vault/seal" "github.com/stretchr/testify/assert" ) diff --git a/vault/seal_wrapped_value.go b/vault/seal_wrapped_value.go index 53502b6ed7..44399fa9f9 100644 --- a/vault/seal_wrapped_value.go +++ b/vault/seal_wrapped_value.go @@ -9,10 +9,9 @@ import ( "errors" "fmt" - "github.com/hashicorp/vault/vault/seal" - "github.com/golang/protobuf/proto" wrapping "github.com/hashicorp/go-kms-wrapping/v2" + "github.com/hashicorp/vault/vault/seal" ) // transitoryGeneration is the Generation value used by SealWrappebValues for diff --git a/vault/seal_wrapped_value_test.go b/vault/seal_wrapped_value_test.go index f17d9b8068..4572557bfe 100644 --- a/vault/seal_wrapped_value_test.go +++ b/vault/seal_wrapped_value_test.go @@ -7,10 +7,9 @@ import ( "fmt" "testing" - "github.com/hashicorp/vault/vault/seal" - "github.com/golang/protobuf/proto" wrapping "github.com/hashicorp/go-kms-wrapping/v2" + "github.com/hashicorp/vault/vault/seal" "github.com/stretchr/testify/assert" ) diff --git a/vault/testing.go b/vault/testing.go index 37f0bfcac1..e82edb2288 100644 --- a/vault/testing.go +++ b/vault/testing.go @@ -34,11 +34,6 @@ import ( log "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-secure-stdlib/reloadutil" kv "github.com/hashicorp/vault-plugin-secrets-kv" - "github.com/mitchellh/copystructure" - "github.com/mitchellh/go-testing-interface" - "golang.org/x/crypto/ed25519" - "golang.org/x/net/http2" - "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/audit" auditFile "github.com/hashicorp/vault/builtin/audit/file" @@ -60,6 +55,10 @@ import ( "github.com/hashicorp/vault/vault/cluster" "github.com/hashicorp/vault/vault/plugincatalog" "github.com/hashicorp/vault/vault/seal" + "github.com/mitchellh/copystructure" + "github.com/mitchellh/go-testing-interface" + "golang.org/x/crypto/ed25519" + "golang.org/x/net/http2" ) // This file contains a number of methods that are useful for unit diff --git a/vault/ui_test.go b/vault/ui_test.go index 3bad3f8f11..8e6bce10ce 100644 --- a/vault/ui_test.go +++ b/vault/ui_test.go @@ -7,10 +7,9 @@ import ( "context" "testing" - "github.com/hashicorp/vault/sdk/logical" - log "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/sdk/helper/logging" + "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/sdk/physical/inmem" )