File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -164,8 +164,16 @@ func isTask(v cue.Value) bool {
164
164
if len (v .Path ().Selectors ()) == 0 {
165
165
return false
166
166
}
167
- return v .Kind () == cue .StructKind &&
168
- (v .Lookup ("$id" ).Exists () || v .Lookup ("kind" ).Exists ())
167
+ if v .Kind () != cue .StructKind {
168
+ return false
169
+ }
170
+ if v .Lookup ("$id" ).Exists () {
171
+ return true
172
+ }
173
+ // Is it an existing legacy kind.
174
+ str , err := v .Lookup ("kind" ).String ()
175
+ _ , ok := legacyKinds [str ]
176
+ return err == nil && ok
169
177
}
170
178
171
179
var legacyKinds = map [string ]string {
@@ -184,10 +192,10 @@ func newTaskFunc(cmd *Command) flow.TaskFunc {
184
192
kind , err := v .Lookup ("$id" ).String ()
185
193
if err != nil {
186
194
// Lookup kind for backwards compatibility.
187
- // TODO: consider at some point whether kind can be removed .
195
+ // This should not be supported for cue run .
188
196
var err1 error
189
197
kind , err1 = v .Lookup ("kind" ).String ()
190
- if err1 != nil {
198
+ if err1 != nil || legacyKinds [ kind ] == "" {
191
199
return nil , errors .Promote (err1 , "newTask" )
192
200
}
193
201
}
You can’t perform that action at this time.
0 commit comments