this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cmd/cue/cmd: only consider "kind" field for known tasks

Signed-off-by: Marcel van Lohuizen <mpvl@golang.org>
Change-Id: Id443821af5e3b2740c741bc8c3823a1e6ba4031e
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/532278
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Paul Jolly <paul@myitcv.io>
Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com>

authored by

Marcel van Lohuizen and committed by
Marcel van Lohuizen
802a8520 bd3b6eaf

+12 -4
+12 -4
cmd/cue/cmd/custom.go
··· 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 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 }