MCPcopy Index your code
hub / github.com/docker/docker-agent / GetVersion

Function GetVersion

pkg/desktop/version.go:25–37  ·  view source on GitHub ↗

GetVersion returns the running Docker Desktop version (e.g. "4.74.0") or an empty string if Docker Desktop is not running or the call fails. The lookup is bounded by a short internal timeout so a stale or missing backend socket cannot stall callers on hot paths (it is queried on every outbound buil

(ctx context.Context)

Source from the content-addressed store, hash-verified

23// HTTP call on a cache miss; on a cache hit the cached value is returned
24// without consulting ctx.
25func GetVersion(ctx context.Context) string {
26 v, _ := versionMemoizer.Memoize("desktopVersion", func() (string, error) {
27 ctx, cancel := context.WithTimeout(ctx, 2*time.Second)
28 defer cancel()
29
30 var info struct {
31 CurrentVersion string `json:"currentVersion"`
32 }
33 _ = ClientBackend.Get(ctx, "/update", &info)
34 return info.CurrentVersion, nil
35 })
36 return v
37}

Callers 1

SetIdentityFunction · 0.92

Calls 2

MemoizeMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected