MCPcopy
hub / github.com/moby/moby / encodePlatform

Function encodePlatform

client/utils.go:109–115  ·  view source on GitHub ↗

encodePlatform marshals the given platform to JSON format, to be used for query-parameters for filtering / selecting platforms. It is used as a helper for encodePlatforms,

(platform *ocispec.Platform)

Source from the content-addressed store, hash-verified

107// be used for query-parameters for filtering / selecting platforms. It
108// is used as a helper for encodePlatforms,
109func encodePlatform(platform *ocispec.Platform) (string, error) {
110 p, err := json.Marshal(platform)
111 if err != nil {
112 return "", fmt.Errorf("%w: invalid platform: %v", cerrdefs.ErrInvalidArgument, err)
113 }
114 return string(p), nil
115}
116
117func decodeWithRaw[T any](resp *http.Response, out *T) (raw json.RawMessage, _ error) {
118 if resp == nil || resp.Body == nil {

Callers 5

encodePlatformsFunction · 0.85
ImageInspectMethod · 0.85
ImageAttestationsMethod · 0.85
ImageHistoryMethod · 0.85

Calls 2

ErrorfMethod · 0.80
MarshalMethod · 0.45

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…