Ensure we can Marshall #Scratch as CUE

Signed-off-by: Joel Longtine <joel@dagger.io>
This commit is contained in:
Joel Longtine
2022-01-07 16:21:06 -07:00
parent 6a7b5f3337
commit a3db716c0a
5 changed files with 70 additions and 9 deletions

View File

@@ -42,8 +42,14 @@ func (fs *FS) State() (llb.State, error) {
func (fs *FS) MarshalCUE() *compiler.Value {
v := compiler.NewValue()
if err := v.FillPath(fsIDPath, fs.id); err != nil {
panic(err)
if fs.result == nil {
if err := v.FillPath(fsIDPath, nil); err != nil {
panic(err)
}
} else {
if err := v.FillPath(fsIDPath, fs.id); err != nil {
panic(err)
}
}
return v
}