fix: return error before accesing mapping resource (#6660)
Some checks failed
CodeQL / Analyze (go) (push) Failing after 2m18s
Definition-Lint / definition-doc (push) Failing after 6m5s
E2E MultiCluster Test / detect-noop (push) Successful in 18s
E2E Test / detect-noop (push) Successful in 21s
Go / detect-noop (push) Successful in 19s
license / Check for unapproved licenses (push) Failing after 2m30s
Registry / publish-core-images (push) Failing after 49s
Unit-Test / detect-noop (push) Successful in 18s
E2E MultiCluster Test / e2e-multi-cluster-tests (v1.29) (push) Failing after 1m28s
E2E Test / e2e-tests (v1.29) (push) Failing after 1m17s
Go / staticcheck (push) Successful in 18m20s
Go / lint (push) Failing after 19m38s
Go / check-diff (push) Failing after 15m6s
Go / check-core-image-build (push) Failing after 4m1s
Go / check-cli-image-build (push) Failing after 3m2s
Unit-Test / unit-tests (push) Failing after 13m29s
Go / check-windows (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Failing after 41s

Signed-off-by: Eko Simanjuntak <ecojuntak@gmail.com>
This commit is contained in:
Eko Simanjuntak
2025-01-24 20:06:13 +01:00
committed by GitHub
parent e63d8c33ec
commit d0d7beb700

View File

@@ -701,9 +701,9 @@ func GetBaseResourceKinds(cueStr string, mapper meta.RESTMapper) (string, error)
GroupAndVersion = append([]string{""}, GroupAndVersion...)
}
mapping, err := mapper.RESTMapping(schema.GroupKind{Group: GroupAndVersion[0], Kind: kind}, GroupAndVersion[1])
gvr := mapping.Resource
if err != nil {
return "", err
}
gvr := mapping.Resource
return fmt.Sprintf("- %s.%s", gvr.Resource, gvr.Group), nil
}