• Madhusudan.C.S's avatar
    Directly grab map values instead of using loop-clause variables when setting up… · 28a65783
    Madhusudan.C.S authored
    Directly grab map values instead of using loop-clause variables when setting up federated sync controller tests.
    
    Go's loop-clause variables are allocated once and the items are copied
    to that variable while iterating through the loop. This means, these
    variables can't escape the scope since closures are bound to loop-clause
    variables whose value change during each iteration. Doing so would lead
    to undesired behavior. For more on this topic see:
    https://github.com/golang/go/wiki/CommonMistakes
    
    So in order to workaround this problem in sync controller e2e tests, we
    iterate through the map and copy the map value to a variable inside the
    loop before using it in closures.
    
    Fixes issue: #47059
    28a65783
crud.go 1.81 KB