Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
YakDriver committed Dec 7, 2023
1 parent 952df23 commit 6457ae4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion internal/framework/flex/autoflex.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ func findFieldFuzzy(ctx context.Context, fieldNameFrom string, valTo reflect.Val
// fourth precedence is using resource prefix
if v, ok := ctx.Value(ResourcePrefix).(string); ok && v != "" {
if ctx.Value(ResourcePrefixRecurse) == nil {
ctx = context.WithValue(ctx, ResourcePrefixRecurse, true) // so it will only recurse once
// so it will only recurse once
ctx = context.WithValue(ctx, ResourcePrefixRecurse, true)
if strings.HasPrefix(fieldNameFrom, v) {
return findFieldFuzzy(ctx, strings.TrimPrefix(fieldNameFrom, v), valTo)
}
Expand Down
8 changes: 4 additions & 4 deletions internal/framework/flex/autoflex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func TestGenericExpand(t *testing.T) {
testString := "test"
testStringResult := "a"
testCases := []struct {
Context context.Context //nolint:containedctx
Context context.Context //nolint:containedctx // testing context use
TestName string
Source any
Target any
Expand Down Expand Up @@ -531,7 +531,7 @@ func TestGenericExpand(t *testing.T) {
},
},
{
Context: context.WithValue(ctx, ResourcePrefix, "Intent"),
Context: context.WithValue(ctx, ResourcePrefix, "Intent"), //nolint:contextcheck // false positive

Check failure on line 534 in internal/framework/flex/autoflex_test.go

View workflow job for this annotation

GitHub Actions / 2 of 2

directive `//nolint:contextcheck // false positive` is unused for linter "contextcheck" (nolintlint)
TestName: "resource name prefix",
Source: &TestFlexTF16{
Name: types.StringValue("Ovodoghen"),
Expand Down Expand Up @@ -768,7 +768,7 @@ func TestGenericFlatten(t *testing.T) {
ctx := context.Background()
testString := "test"
testCases := []struct {
Context context.Context //nolint:containedctx
Context context.Context //nolint:containedctx // testing context use
TestName string
Source any
Target any
Expand Down Expand Up @@ -1182,7 +1182,7 @@ func TestGenericFlatten(t *testing.T) {
},
},
{
Context: context.WithValue(ctx, ResourcePrefix, "Intent"),
Context: context.WithValue(ctx, ResourcePrefix, "Intent"), //nolint:contextcheck // false positive

Check failure on line 1185 in internal/framework/flex/autoflex_test.go

View workflow job for this annotation

GitHub Actions / 2 of 2

directive `//nolint:contextcheck // false positive` is unused for linter "contextcheck" (nolintlint)
TestName: "resource name prefix",
Source: &TestFlexAWS18{
IntentName: aws.String("Ovodoghen"),
Expand Down

0 comments on commit 6457ae4

Please sign in to comment.