Skip to content

client: ImagePullResponse: use sync.OnceValue#51160

Merged
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:oncevalue
Oct 10, 2025
Merged

client: ImagePullResponse: use sync.OnceValue#51160
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:oncevalue

Conversation

@thaJeztah
Copy link
Member

- What I did

- How I did it

- How to verify it

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah added this to the 29.0.0 milestone Oct 10, 2025
@thaJeztah thaJeztah added status/2-code-review kind/refactor PR's that refactor, or clean-up code module/client labels Oct 10, 2025
}
})
return err
return r.close()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This slightly changes the behavior - previously the error would only be returned on the first Close call. Now each Close call will still return the same error as the first run.

Probably not a big issue in this case... but worth pointing out just in case

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! Good call; I was thinking "we capture the err" but of course that err var is created on every invocation.

I guess keeping the err var is actually more "correct", or, well, it would return the same result every time it's called

@thaJeztah
Copy link
Member Author

I'll bring this one in once CI completes; the thing I was considering with this change;

  • It keeps sync.Once out of the structure entirely
  • it's slightly cleaner
  • With the sync.Once out of the signature, we can add Methods in future that DO have a pointer-receiver in case we want them to mutate the struct (don't have ideas yet if we need, but .. maybe?)

@thaJeztah
Copy link
Member Author

Failure is unrelated; flaky test;


=== Failed
=== FAIL: amd64.docker.docker.integration.networking TestBridgeICC/IPv6_ULA_on_internal_network (4.57s)
    firewall.go:69: Firewalld reload completed at 2025-10-10T09:34:58Z
    bridge_linux_test.go:218: assertion failed: 1 (res.ExitCode int) != 0 (int)
    bridge_linux_test.go:220: assertion failed: string "PING ctr-icc-3-1 (fdf1:a844:380c:b247::2): 56 data bytes\n\n--- ctr-icc-3-1 ping statistics ---\n1 packets transmitted, 0 packets received, 100% packet loss\n" does not contain "1 packets transmitted, 1 packets received"
    --- FAIL: TestBridgeICC/IPv6_ULA_on_internal_network (4.57s)

=== FAIL: amd64.docker.docker.integration.networking TestBridgeICC (25.75s)

@thaJeztah thaJeztah merged commit cfefa33 into moby:master Oct 10, 2025
262 of 264 checks passed
@thaJeztah thaJeztah deleted the oncevalue branch October 10, 2025 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor PR's that refactor, or clean-up code module/client status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants