mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: make WithAPIVersion, WithAPIVersionFromEnv order-independent
Environment-variables are expected to override config / defaults, so make sure that the DOCKER_API_VERSION env-var always takes priority. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -89,6 +89,10 @@ func (cli *Client) Ping(ctx context.Context, options PingOptions) (PingResult, e
|
||||
}
|
||||
|
||||
if cli.negotiated.Load() && !options.ForceNegotiate {
|
||||
// API version was already negotiated or manually set.
|
||||
//
|
||||
// We check cli.negotiated again under lock, to account for race
|
||||
// conditions with the check at the start of this function.
|
||||
return ping, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user