google-cloud-go icon indicating copy to clipboard operation
google-cloud-go copied to clipboard

spanner: defers are executed at the end of func

Open egonelbre opened this issue 1 year ago • 0 comments

Tracking issue for https://github.com/googleapis/google-cloud-go/pull/9759

Related https://github.com/googleapis/google-cloud-go/issues/9784

Currently there are quite a few tests that have a code along the lines of:

for _, test := range testcases {
    client := NewClient(...)
    defer client.Close()

This closing will happen at the end of the function, not at the end of the for loop.

egonelbre avatar Jun 05 '24 07:06 egonelbre