tools: Expose ref-engine discovery casEngines #39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously these were not provided in the output JSON.
To store the data during resolution, create a new
resolvedNametype. That type extends the usualMerkleRootJSON with a newcasEnginesproperty that is a sibling ofMerkleRoot'srootanduriproperties. To get the sibling serialization, we need a littleMarshalJSONwrapper forresolvedName, but we don't need to bother withUnmarshalJSONbecause this isn't a public library type.Rename
allRootstoresolvedNames, because each key in the map is an image name. Each value in the map may contain several roots (resolveNames), soallRootswasn't particularly clear.Move
refenginediscovery.ResolvedCASEnginetoengine.Reference. This gives us a shorter name, and lets us recycle some code via the new (private)(*Config).unmarshalInterface. That lets us get the same config serialization inReferencewithout the wash through[]bytethat I use inresolvedName.MarshalJSON. Washing through[]byteis an acceptable hack for command-line-specific code, but it's nice to avoid it in the library code.While we're at it, clean up the
MerkleRootJSON handling, dropping the tag fromMediaType(redundant because our JSON helpers don't use reflection) and adding comments for the public methods.Alphabetizing the root entries in the oci-discovery README example probably should have happened back in #29, since that's when we started using a
map[string]interface{}inMerkleRoot.MarshalJSON.Builds on #38; review that first.