added support for output scanning

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba
2021-05-31 15:24:42 +02:00
parent 21b259fc86
commit 6e3ec02ceb
2 changed files with 43 additions and 0 deletions

View File

@@ -66,3 +66,23 @@ func scanInputs(ctx context.Context, value *compiler.Value) []*compiler.Value {
return inputs
}
func scanOutputs(ctx context.Context, value *compiler.Value) []*compiler.Value {
lg := log.Ctx(ctx)
inputs := []*compiler.Value{}
value.Walk(
func(val *compiler.Value) bool {
if !val.HasAttr("output") {
return true
}
lg.Debug().Str("value.Path", val.Path().String()).Msg("found output")
inputs = append(inputs, val)
return true
}, nil,
)
return inputs
}