Skip to content

Commit 920eb32

Browse files
committed
fix: Addressing lints
1 parent aac7326 commit 920eb32

9 files changed

Lines changed: 15 additions & 16 deletions

File tree

internal/awshelper/policy_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ func TestAwsUnmarshalActionResourceList(t *testing.T) {
9292
assert.NotNil(t, bucketPolicy.Statement[0].Resource)
9393

9494
switch actions := bucketPolicy.Statement[0].Action.(type) {
95-
case []interface{}:
95+
case []any:
9696
assert.Len(t, actions, 11)
9797
assert.Contains(t, actions, "s3:ListJobs")
9898
default:
9999
assert.Fail(t, "Expected []string type for Action")
100100
}
101101

102102
switch resource := bucketPolicy.Statement[0].Resource.(type) {
103-
case []interface{}:
103+
case []any:
104104
assert.Len(t, resource, 2)
105105
assert.Contains(t, resource, "arn:aws:s3:*:666:job/*")
106106
default:

internal/runner/configstack/runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ func (runner *Runner) acquireCredentials(ctx context.Context, l log.Logger, opts
664664
}
665665

666666
// nolint:unparam
667-
func (runner *Runner) partialParseConfig(ctx context.Context, parseCtx *config.ParsingContext, l log.Logger, terragruntConfigPath string, includeConfig *config.IncludeConfig, howThisUnitWasFound string) (*config.TerragruntConfig, error) {
667+
func (runner *Runner) partialParseConfig(_ context.Context, parseCtx *config.ParsingContext, l log.Logger, terragruntConfigPath string, includeConfig *config.IncludeConfig, howThisUnitWasFound string) (*config.TerragruntConfig, error) {
668668
terragruntConfig, err := config.PartialParseConfigFile( //nolint:contextcheck
669669
parseCtx,
670670
l,

internal/runner/runner.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
package runner
33

44
import (
5+
"maps"
56
"context"
67
"path/filepath"
78
"slices"
@@ -41,9 +42,7 @@ func FindWhereWorkingDirIsIncluded(ctx context.Context, l log.Logger, opts *opti
4142
pathsToCheck := discoverPathsToCheck(ctx, l, opts, terragruntConfig)
4243

4344
for _, dir := range pathsToCheck {
44-
for k, v := range findMatchingUnitsInPath(ctx, l, dir, opts, terragruntConfig) {
45-
matchedModulesMap[k] = v
46-
}
45+
maps.Copy(matchedModulesMap, findMatchingUnitsInPath(ctx, l, dir, opts, terragruntConfig))
4746
}
4847

4948
var matchedModules = make(common.Units, 0, len(matchedModulesMap))

test/helpers/aws.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
func DeleteS3BucketWithRetry(t *testing.T, awsRegion string, bucketName string) {
1414
t.Helper()
1515

16-
for i := 0; i < 3; i++ {
16+
for range 3 {
1717
err := DeleteS3Bucket(t, awsRegion, bucketName)
1818
if err == nil {
1919
return

test/integration_aws_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ func TestAwsDependencyOutputSameOutputConcurrencyRegression(t *testing.T) {
12991299
require.NoError(t, err)
13001300
}
13011301

1302-
for i := 0; i < 3; i++ {
1302+
for range 3 {
13031303
tt()
13041304
// We need to bust the output cache that stores the dependency outputs so that the second run pulls the outputs.
13051305
// This is only a problem during testing, where the process is shared across terragrunt runs.
@@ -1400,7 +1400,7 @@ func TestAwsParallelStateInit(t *testing.T) {
14001400
t.Parallel()
14011401

14021402
tmpEnvPath := t.TempDir()
1403-
for i := 0; i < 20; i++ {
1403+
for i := range 20 {
14041404
err := util.CopyFolderContents(logger.CreateLogger(), testFixtureParallelStateInit, tmpEnvPath, ".terragrunt-test", nil, nil)
14051405
require.NoError(t, err)
14061406
err = os.Rename(

test/integration_find_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func TestFindDAGWithMixedDependencies(t *testing.T) {
166166
}
167167

168168
// jsonStringsEqual compares two JSON strings for equivalence, ignoring the order of nested arrays.
169-
func jsonStringsEqual(t *testing.T, expected, actual string, msgAndArgs ...interface{}) bool {
169+
func jsonStringsEqual(t *testing.T, expected, actual string, msgAndArgs ...any) bool {
170170
t.Helper()
171171

172172
patch, err := jsondiff.CompareJSON([]byte(expected), []byte(actual), jsondiff.Equivalent())

test/integration_runner_pool_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func TestRunnerPoolTerragruntDestroyOrder(t *testing.T) {
6767
// Parse the destruction order from stdout
6868
var destroyOrder []string
6969
re := regexp.MustCompile(`Hello, Module ([A-Za-z]+)`)
70-
for _, line := range strings.Split(stdout, "\n") {
70+
for line := range strings.SplitSeq(stdout, "\n") {
7171
if match := re.FindStringSubmatch(line); match != nil {
7272
destroyOrder = append(destroyOrder, "module-"+strings.ToLower(match[1]))
7373
}

test/integration_serial_aws_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func testRemoteFixtureParallelism(t *testing.T, parallelism int, numberOfModules
162162

163163
// copy the template `numberOfModules` times into the app
164164
tmpEnvPath := t.TempDir()
165-
for i := 0; i < numberOfModules; i++ {
165+
for i := range numberOfModules {
166166
err := util.CopyFolderContents(createLogger(), testFixtureParallelism, tmpEnvPath, ".terragrunt-test", nil, nil)
167167
if err != nil {
168168
return "", 0, err

test/integration_sops_kms_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ func TestAwsSopsDecryptedKMSCorrectly(t *testing.T) {
3636
outputs := map[string]helpers.TerraformOutput{}
3737
require.NoError(t, json.Unmarshal(stdout.Bytes(), &outputs))
3838

39-
assert.Equal(t, []interface{}{true, false}, outputs["json_bool_array"].Value)
40-
assert.Equal(t, []interface{}{"example_value1", "example_value2"}, outputs["json_string_array"].Value)
39+
assert.Equal(t, []any{true, false}, outputs["json_bool_array"].Value)
40+
assert.Equal(t, []any{"example_value1", "example_value2"}, outputs["json_string_array"].Value)
4141
assert.InEpsilon(t, 1234.56789, outputs["json_number"].Value, 0.0001)
4242
assert.Equal(t, "example_value", outputs["json_string"].Value)
4343
assert.Equal(t, "Welcome to SOPS! Edit this file as you please!", outputs["json_hello"].Value)
44-
assert.Equal(t, []interface{}{true, false}, outputs["yaml_bool_array"].Value)
45-
assert.Equal(t, []interface{}{"example_value1", "example_value2"}, outputs["yaml_string_array"].Value)
44+
assert.Equal(t, []any{true, false}, outputs["yaml_bool_array"].Value)
45+
assert.Equal(t, []any{"example_value1", "example_value2"}, outputs["yaml_string_array"].Value)
4646
assert.InEpsilon(t, 1234.5679, outputs["yaml_number"].Value, 0.0001)
4747
assert.Equal(t, "example_value", outputs["yaml_string"].Value)
4848
assert.Equal(t, "Welcome to SOPS! Edit this file as you please!", outputs["yaml_hello"].Value)

0 commit comments

Comments
 (0)