MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / resolve_go_name

Function resolve_go_name

deploy/sbom/resolve_licenses.py:284–300  ·  view source on GitHub ↗

Resolve a Go module name to a known license via GO_KNOWN map.

(full_name: str)

Source from the content-addressed store, hash-verified

282
283
284def resolve_go_name(full_name: str) -> str | None:
285 """Resolve a Go module name to a known license via GO_KNOWN map."""
286 # Try exact match first
287 if full_name in GO_KNOWN:
288 return GO_KNOWN[full_name]
289 # Try stripping version suffix (e.g. github.com/foo/bar/v2 -> github.com/foo/bar)
290 parts = full_name.split("/")
291 for i in range(len(parts), 1, -1):
292 candidate = "/".join(parts[:i])
293 if candidate in GO_KNOWN:
294 return GO_KNOWN[candidate]
295 # Try just org/repo for github.com paths
296 if full_name.startswith("github.com/") and len(parts) >= 3:
297 base = "/".join(parts[:3])
298 if base in GO_KNOWN:
299 return GO_KNOWN[base]
300 return None
301
302
303def resolve_component(comp: dict) -> str | None:

Callers 1

resolve_componentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected