1. Do not introduce another dt variable. 2. Wrap the error similar to all the others. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@@ -78,9 +78,9 @@ func patchImageConfig(dt []byte, dps []digest.Digest, history []ocispec.History,
}
if cache != nil {
- dt, err := json.Marshal(cache)
+ dt, err = json.Marshal(cache)
if err != nil {
- return nil, err
+ return nil, errors.Wrap(err, "failed to marshal cache")
m["moby.buildkit.cache.v0"] = dt