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.76k stars 9.12k forks source link

tests/provider: Fix and enable wastedassign linter #18596

Open bflad opened 3 years ago

bflad commented 3 years ago

Community Note

Description

The wastedassign linter finds wasted assignment statements. This typically represents a stylistic coding issue and fixing reports will increase code readability. This linter is similar to ifeffassign, but catches different reports. It is supported in golangci-lint.

Affected Resource(s)

aws/data_source_aws_s3_bucket_object.go:220:3: reassigned, but reassigned without using the value (wastedassign)
                contentType := ""
                ^
aws/data_source_aws_sagemaker_prebuilt_ecr_image.go:343:2: reassigned, but reassigned without using the value (wastedassign)
        id := ""
        ^
aws/resource_aws_autoscaling_group_waiting.go:79:2: reassigned, but reassigned without using the value (wastedassign)
        recentStatus := ""
        ^
aws/resource_aws_dx_gateway_association.go:124:2: reassigned, but reassigned without using the value (wastedassign)
        associationId := ""
        ^
aws/resource_aws_ebs_volume.go:235:5: reassigned, but never used afterwards (wastedassign)
                                resp = nil
                                ^
aws/resource_aws_efs_file_system.go:145:2: reassigned, but reassigned without using the value (wastedassign)
        creationToken := ""
        ^
aws/resource_aws_opsworks_permission.go:85:2: reassigned, but reassigned without using the value (wastedassign)
        id := ""
        ^
aws/resource_aws_opsworks_rds_db_instance.go:109:2: reassigned, but reassigned without using the value (wastedassign)
        id := ""
        ^

Definition of Done

ewbankkit commented 1 year ago

wastedassign is currently disabled for go1.18+: