MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / ensureScheme

Function ensureScheme

pkg/policies/loader.go:330–339  ·  view source on GitHub ↗
(ref string, expected ...string)

Source from the content-addressed store, hash-verified

328}
329
330func ensureScheme(ref string, expected ...string) (string, error) {
331 scheme, id := RefParts(ref)
332 for _, ex := range expected {
333 if scheme == ex {
334 return id, nil
335 }
336 }
337
338 return "", fmt.Errorf("unexpected policy reference scheme: %q", scheme)
339}
340
341func RefParts(ref string) (string, string) {
342 parts := strings.SplitN(ref, "://", 2)

Callers 6

TestEnsureSchemeFunction · 0.85
LoadMethod · 0.85
LoadMethod · 0.85
LoadMethod · 0.85
LoadMethod · 0.85

Calls 1

RefPartsFunction · 0.85

Tested by 1

TestEnsureSchemeFunction · 0.68