hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.85k stars 9.19k forks source link

Tech debt: Clean up import declarations in Go code #15903

Closed YakDriver closed 4 years ago

YakDriver commented 4 years ago

Community Note

Description

To comply with gofmt, go fmt, goimports, and good practice,

Imports declarations in the AWS Terraform Provider Go code should conform to these rules:

  1. Import declarations are grouped into 3 groups:
    • Short import path packages (i.e., built-in packages) (if any)
    • Long import path packages (if any)
    • Local import path packages (if any)
  2. Declaration groups themselves should be in this order: short import path, long import path, local import paths.
  3. Declaration groups should be separated by a single blank line.
  4. Within each group, the lines should be in alphabetical order.

Examples

Bad Example 1. This example is not grouped into short-path and long-path groups and the malformed groups are not alphabetized.

import (
    "fmt"
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
    "regexp"
    "testing"

    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
 )

Fixed Example 1.

import (
    "fmt"
    "regexp"
    "testing"

    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
 )

Bad Example 2. This example is not grouped into short-path and long-path groups, there are extra lines within the long-path group, and the malformed groups are not alphabetized.

import (
    "fmt"

    "github.com/aws/aws-sdk-go/service/ec2"
    "github.com/aws/aws-sdk-go/aws"

    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

    "log"
 )

Fixed Example 2.

import (
    "fmt"
    "log"

    "github.com/aws/aws-sdk-go/aws"
    "github.com/aws/aws-sdk-go/service/ec2"
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
 )
anGie44 commented 4 years ago

hmm sounds like we may need a linter 😈? quick peep at https://github.com/golangci/awesome-go-linters led me to https://github.com/pavius/impi which could be promising but not certain if it checks for alphabetical order

bflad commented 4 years ago

For external context to those seeing this issue, we prefer to not enable goimports because it takes 10+ minutes.

There's also gci, which is baked into golangci-lint already. It runs okay speed-wise, but the output isn't the most helpful other than to say to run the tool to fix it currently by default:

$ time golangci-lint run --enable gci ./aws
aws/data_source_aws_backup_plan.go:4: File is not `gci`-ed (gci)
    "fmt"
aws/data_source_aws_backup_selection.go:4: File is not `gci`-ed (gci)
    "fmt"
aws/data_source_aws_backup_vault.go:4: File is not `gci`-ed (gci)
    "fmt"
aws/data_source_aws_directory_service_directory.go:6: File is not `gci`-ed (gci)

aws/data_source_aws_directory_service_directory.go:9: File is not `gci`-ed (gci)

    "github.com/aws/aws-sdk-go/aws"
    "github.com/aws/aws-sdk-go/service/directoryservice"
aws/data_source_aws_ebs_volumes.go:10: File is not `gci`-ed (gci)

aws/data_source_aws_ec2_instance_type.go:4: File is not `gci`-ed (gci)
    "fmt"
aws/data_source_aws_ec2_instance_type.go:8: File is not `gci`-ed (gci)
    "log"
aws/data_source_aws_iam_role.go:8: File is not `gci`-ed (gci)
    "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags"

aws/data_source_aws_iam_role.go:12: File is not `gci`-ed (gci)
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
aws/data_source_aws_pricing_product.go:4: File is not `gci`-ed (gci)
    "log"

aws/data_source_aws_pricing_product.go:7: File is not `gci`-ed (gci)
    "fmt"
aws/data_source_aws_qldb_ledger.go:4: File is not `gci`-ed (gci)
    "fmt"
aws/data_source_aws_qldb_ledger.go:7: File is not `gci`-ed (gci)
    "github.com/aws/aws-sdk-go/service/qldb"
aws/data_source_aws_qldb_ledger.go:9: File is not `gci`-ed (gci)

    "log"
    "regexp"

    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
aws/data_source_aws_waf_rate_based_rule.go:4: File is not `gci`-ed (gci)
    "fmt"
aws/data_source_aws_waf_rule.go:4: File is not `gci`-ed (gci)
    "fmt"
aws/data_source_aws_waf_web_acl.go:4: File is not `gci`-ed (gci)
    "fmt"
aws/data_source_aws_wafregional_rate_based_rule.go:4: File is not `gci`-ed (gci)
    "fmt"
aws/data_source_aws_wafregional_rule.go:4: File is not `gci`-ed (gci)
    "fmt"
aws/data_source_aws_wafregional_rule.go:7: File is not `gci`-ed (gci)

aws/data_source_aws_wafregional_web_acl.go:4: File is not `gci`-ed (gci)
    "fmt"
aws/data_source_aws_workspaces_directory.go:8: File is not `gci`-ed (gci)

aws/ec2_filters.go:8: File is not `gci`-ed (gci)

aws/provider.go:7: File is not `gci`-ed (gci)

aws/resource_aws_ami.go:14: File is not `gci`-ed (gci)

aws/resource_aws_appautoscaling_policy.go:6: File is not `gci`-ed (gci)
    "strconv"
aws/resource_aws_appautoscaling_policy.go:8: File is not `gci`-ed (gci)

    "strings"
aws/resource_aws_athena_database.go:9: File is not `gci`-ed (gci)
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

aws/resource_aws_athena_database.go:14: File is not `gci`-ed (gci)
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
aws/resource_aws_batch_job_definition.go:3: File is not `gci`-ed (gci)
import (
aws/resource_aws_batch_job_definition.go:5: File is not `gci`-ed (gci)

    "encoding/json"
aws/resource_aws_cloudhsm2_hsm.go:8: File is not `gci`-ed (gci)
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

aws/resource_aws_cloudhsm2_hsm.go:12: File is not `gci`-ed (gci)
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
aws/resource_aws_cloudwatch_event_target.go:10: File is not `gci`-ed (gci)
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

aws/resource_aws_cloudwatch_event_target.go:15: File is not `gci`-ed (gci)
    events "github.com/aws/aws-sdk-go/service/cloudwatchevents"
aws/resource_aws_cloudwatch_log_group.go:8: File is not `gci`-ed (gci)
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

aws/resource_aws_cloudwatch_log_group.go:13: File is not `gci`-ed (gci)
    "github.com/aws/aws-sdk-go/service/cloudwatchlogs"
aws/resource_aws_cloudwatch_log_metric_filter.go:7: File is not `gci`-ed (gci)

aws/resource_aws_cloudwatch_log_metric_filter.go:11: File is not `gci`-ed (gci)

    "github.com/aws/aws-sdk-go/aws"
    "github.com/aws/aws-sdk-go/aws/awserr"
    "github.com/aws/aws-sdk-go/service/cloudwatchlogs"
aws/resource_aws_codedeploy_app.go:8: File is not `gci`-ed (gci)
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

aws/resource_aws_codedeploy_app.go:12: File is not `gci`-ed (gci)
    "github.com/aws/aws-sdk-go/service/codedeploy"
aws/resource_aws_config_configuration_recorder.go:6: File is not `gci`-ed (gci)

aws/resource_aws_config_configuration_recorder.go:9: File is not `gci`-ed (gci)

    "github.com/aws/aws-sdk-go/aws"
    "github.com/aws/aws-sdk-go/service/configservice"
aws/resource_aws_config_configuration_recorder_status.go:7: File is not `gci`-ed (gci)
    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

aws/resource_aws_config_configuration_recorder_status.go:10: File is not `gci`-ed (gci)
    "github.com/aws/aws-sdk-go/service/configservice"
aws/resource_aws_config_delivery_channel.go:7: File is not `gci`-ed (gci)

aws/resource_aws_config_delivery_channel.go:11: File is not `gci`-ed (gci)

    "github.com/aws/aws-sdk-go/aws"
    "github.com/aws/aws-sdk-go/aws/awserr"
    "github.com/aws/aws-sdk-go/service/configservice"
aws/resource_aws_config_remediation_configuration.go:7: File is not `gci`-ed (gci)

aws/resource_aws_config_remediation_configuration.go:13: File is not `gci`-ed (gci)

    "github.com/aws/aws-sdk-go/aws"
    "github.com/aws/aws-sdk-go/service/configservice"
...
golangci-lint run --enable gci ./aws  162.00s user 15.30s system 434% cpu 40.839 total

impi is pretty fast.

$  time impi --local . --scheme stdThirdPartyLocal ./...
aws/data_source_aws_backup_plan.go: Imports of different types are not allowed in the same group (0):   "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/data_source_aws_backup_plan_test.go: Imports of different types are not allowed in the same group (0):  "fmt" !=    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
aws/data_source_aws_backup_selection.go: Imports of different types are not allowed in the same group (0):  "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/data_source_aws_backup_selection_test.go: Imports of different types are not allowed in the same group (0):     "fmt" !=    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
aws/data_source_aws_backup_vault.go: Imports of different types are not allowed in the same group (0):  "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/data_source_aws_backup_vault_test.go: Imports of different types are not allowed in the same group (0):     "fmt" !=    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
aws/data_source_aws_directory_service_directory.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/data_source_aws_ebs_encryption_by_default_test.go: Imports of different types are not allowed in the same group (0):    "fmt" !=    "github.com/aws/aws-sdk-go/service/ec2"
aws/data_source_aws_ebs_default_kms_key_test.go: Imports of different types are not allowed in the same group (0):  "fmt" !=    "github.com/aws/aws-sdk-go/service/ec2"
aws/data_source_aws_ebs_volumes.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/data_source_aws_ec2_instance_type.go: Imports of different types are not allowed in the same group (0):     "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/data_source_aws_ec2_instance_type_test.go: Imports of different types are not allowed in the same group (0):    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" !=   "testing"
aws/data_source_aws_iam_role.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/data_source_aws_kms_secrets_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/data_source_aws_qldb_ledger_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/data_source_aws_pricing_product.go: Import groups are not in the proper order: ["Std" "Std" "Third party"]
aws/data_source_aws_qldb_ledger.go: Expected no more than 3 groups, got 4
aws/data_source_aws_security_group_test.go: Import groups are not in the proper order: ["Std" "Std" "Third party"]
aws/data_source_aws_waf_rate_based_rule.go: Imports of different types are not allowed in the same group (0):   "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/data_source_aws_waf_rule.go: Imports of different types are not allowed in the same group (0):  "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/data_source_aws_wafregional_rate_based_rule.go: Imports of different types are not allowed in the same group (0):   "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/data_source_aws_wafregional_web_acl.go: Imports of different types are not allowed in the same group (0):   "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/data_source_aws_waf_web_acl.go: Imports of different types are not allowed in the same group (0):   "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/data_source_aws_wafregional_rule.go: Imports of different types are not allowed in the same group (0):  "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/data_source_aws_workspaces_directory.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/ec2_filters.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/ec2_filters_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_acm_certificate_test.go: Import groups are not in the proper order: ["Std" "Std" "Third party"]
aws/resource_aws_ami.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/provider.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_app_cookie_stickiness_policy_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_appautoscaling_policy.go: Import groups are not in the proper order: ["Std" "Std" "Third party"]
aws/resource_aws_appsync_function_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_athena_database.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_athena_workgroup_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_batch_job_definition.go: Import groups are not in the proper order: ["Std" "Std" "Third party"]
aws/resource_aws_cloudhsm2_hsm.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_cloudtrail_test.go: Import groups are not in the proper order: ["Std" "Std" "Third party"]
aws/resource_aws_cloudwatch_event_permission_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_cloudwatch_event_target.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_cloudwatch_log_resource_policy_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_cloudwatch_log_group.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_cloudwatch_log_metric_filter.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_codebuild_source_credential_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_codebuild_report_group_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_codedeploy_app.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_codebuild_project_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_config_configuration_recorder_status.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_config_configuration_recorder.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_config_delivery_channel.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_config_remediation_configuration.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_datapipeline_pipeline_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_db_subnet_group_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_directory_service_conditional_forwarder.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_directory_service_log_subscription_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_directory_service_conditional_forwarder_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_docdb_cluster_instance_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_docdb_cluster_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_directory_service_directory_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_docdb_subnet_group_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_ebs_encryption_by_default.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_ebs_default_kms_key.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_ebs_volume.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_ec2_traffic_mirror_target_test.go: Expected no more than 3 groups, got 4
aws/resource_aws_ec2_traffic_mirror_filter_rule_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_ec2_traffic_mirror_session_test.go: Expected no more than 3 groups, got 4
aws/resource_aws_ec2_traffic_mirror_filter_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_ec2_transit_gateway_route.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_efs_file_system_policy_test.go: Imports of different types are not allowed in the same group (0):  "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/resource_aws_efs_access_point_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_efs_mount_target_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_eip_association.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_efs_file_system_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_elastic_beanstalk_configuration_template.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_elasticache_parameter_group.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_globalaccelerator_listener.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_globalaccelerator_endpoint_group.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_globalaccelerator_accelerator.go: Expected no more than 3 groups, got 4
aws/resource_aws_glue_catalog_database_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_glue_catalog_database.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_glue_data_catalog_encryption_settings.go: Imports of different types are not allowed in the same group (0):    "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/resource_aws_glue_catalog_table_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_glue_resource_policy_test.go: Imports of different types are not allowed in the same group (0):    "fmt" !=    "github.com/aws/aws-sdk-go/service/glue"
aws/resource_aws_iam_account_password_policy.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_iam_access_key.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_iam_group_policy.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_iam_openid_connect_provider.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_iam_group.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_iam_instance_profile.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_iam_role_policy.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_iam_role.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_iam_user_policy.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_iam_user_group_membership_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_iam_user_group_membership.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_iam_user_login_profile_test.go: Import groups are not in the proper order: ["Std" "Std" "Third party"]
aws/resource_aws_iam_user_ssh_key.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_iam_user_test.go: Import groups are not in the proper order: ["Std" "Std" "Third party"]
aws/resource_aws_iam_user.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_kinesis_stream.go: Import groups are not in the proper order: ["Std" "Std" "Third party"]
aws/resource_aws_kms_alias.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_kinesis_video_stream.go: Expected no more than 3 groups, got 4
aws/resource_aws_lambda_event_source_mapping.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_lambda_function.go: Expected no more than 3 groups, got 4
aws/resource_aws_lb_cookie_stickiness_policy_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_lb_ssl_negotiation_policy_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_load_balancer_policy_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_load_balancer_listener_policy_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_media_convert_queue.go: Expected no more than 3 groups, got 4
aws/resource_aws_media_convert_queue_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_msk_cluster_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_neptune_subnet_group_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_opsworks_instance.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_opsworks_user_profile.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_pinpoint_adm_channel_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_opsworks_stack_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_pinpoint_apns_channel_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_pinpoint_apns_voip_channel_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_pinpoint_apns_sandbox_channel_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_pinpoint_email_channel_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_pinpoint_apns_voip_sandbox_channel_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_pinpoint_baidu_channel_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_quicksight_group.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_pinpoint_sms_channel_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_quicksight_user.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_quicksight_user_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_quicksight_group_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_pinpoint_gcm_channel_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_qldb_ledger.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_qldb_ledger_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_ram_principal_association.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_ram_principal_association_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_ram_resource_share_accepter.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_rds_cluster_instance.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_ram_resource_association_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_ram_resource_share_accepter_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_ram_resource_share_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_rds_cluster_parameter_group.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_rds_cluster_instance_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_redshift_snapshot_schedule_association.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_route53_query_log.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_route53_delegation_set.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_route53_health_check.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_route53_delegation_set_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_route53_resolver_rule_association_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_route53_record.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_route53_resolver_rule_association.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_route53_vpc_association_authorization.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_route53_vpc_association_authorization_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_route53_zone_association.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_route53_record_test.go: Expected no more than 3 groups, got 4
aws/resource_aws_route53_resolver_rule_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_s3_bucket_notification.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_s3_bucket_metric_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_s3_bucket_public_access_block.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_s3_bucket_public_access_block_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_sagemaker_endpoint_configuration_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_sagemaker_notebook_instance_lifecycle_configuration_test.go: Expected no more than 3 groups, got 4
aws/resource_aws_s3_bucket_notification_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_secretsmanager_secret_version.go: Import groups are not in the proper order: ["Std" "Std" "Third party"]
aws/resource_aws_securityhub_product_subscription_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_servicecatalog_portfolio_test.go: Expected no more than 3 groups, got 4
aws/resource_aws_ses_template_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_simpledb_domain.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_sns_topic_policy.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_sns_topic_subscription.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_ssm_maintenance_window_target.go: Imports of different types are not allowed in the same group (0):    "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/resource_aws_ssm_maintenance_window_task.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_transfer_ssh_key.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_transfer_ssh_key_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_transfer_server_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_vpc_endpoint_service_allowed_principal_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_vpc_endpoint_connection_notification_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_transfer_user_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_waf_byte_match_set.go: Imports of different types are not allowed in the same group (0):   "fmt" !=    "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
aws/resource_aws_vpn_connection_route.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_waf_geo_match_set_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_waf_byte_match_set_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_vpn_connection_route_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_waf_size_constraint_set_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_waf_rule_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_waf_sql_injection_match_set_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_wafv2_web_acl_logging_configuration.go: Imports of different types are not allowed in the same group (0):  "fmt" !=    "github.com/aws/aws-sdk-go/aws"
aws/resource_aws_worklink_website_certificate_authority_association.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_workspaces_workspace.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_workspaces_directory.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_worklink_fleet_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_worklink_website_certificate_authority_association_test.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/resource_aws_worklink_fleet.go: Import groups are not in the proper order: ["Std" "Third party" "Third party"]
aws/internal/keyvaluetags/service_tags_gen_test.go: Imports of different types are not allowed in the same group (0):   "github.com/aws/aws-sdk-go/service/quicksight" !=   "testing"
aws/internal/service/glue/waiter/waiter.go: Imports of different types are not allowed in the same group (0):   "github.com/aws/aws-sdk-go/service/glue" !=     "time"

impi verification failed: Found 190 errors
impi --local . --scheme stdThirdPartyLocal ./...  0.39s user 0.38s system 286% cpu 0.270 total
YakDriver commented 4 years ago

@anGie44 @bflad impi is cool. Very simple, which makes it fast. Neither goimports nor gofmt care about grouping/new lines much. Handily, impi does exactly that! Alphabeticizing within groups is handled by gofmt, it's just getting everything into proper groups in the first place.

ghost commented 3 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!