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