moved secret.MarshalCUE to outside of Walk

Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
Richard Jones 2022-01-25 16:49:27 -07:00
parent 3292771811
commit a3c9c008c2
No known key found for this signature in database
GPG Key ID: CFB3A382EB166F4C

View File

@ -50,7 +50,7 @@ func (c *transformSecretTask) Run(ctx context.Context, pctx *plancontext.Context
type pathSecret struct {
path cue.Path
value *compiler.Value
secret *plancontext.Secret
}
var pathsSecrets []pathSecret
@ -66,14 +66,14 @@ func (c *transformSecretTask) Run(ctx context.Context, pctx *plancontext.Context
newLeafSelectors := v.Path().Selectors()[len(functionPathSelectors):]
newLeafSelectors = append(newLeafSelectors, cue.Str("contents"))
newLeafPath := cue.MakePath(newLeafSelectors...)
pathsSecrets = append(pathsSecrets, pathSecret{newLeafPath, secret.MarshalCUE()})
pathsSecrets = append(pathsSecrets, pathSecret{newLeafPath, secret})
}
})
output := compiler.NewValue()
for _, ps := range pathsSecrets {
output.FillPath(ps.path, ps.value)
output.FillPath(ps.path, ps.secret.MarshalCUE())
}
return output, nil