Help us shape the future of Go! Take the 2026 Go Developer Survey

purl

package
v1.124.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package purl parses Package URL (PURL) strings into the subset the Dependency Firewall check command supports: npm, pypi, maven, gem, and cargo. It wraps github.com/package-url/packageurl-go and normalises each PURL type's name to its registry form.

Index

Constants

This section is empty.

Variables

View Source
var (
	TypeNpm   = packageurl.TypeNPM
	TypePypi  = packageurl.TypePyPi
	TypeMaven = packageurl.TypeMaven
	TypeGem   = packageurl.TypeGem
	TypeCargo = packageurl.TypeCargo
)

Supported PURL type identifiers. Values match the package-url spec. Declared as var to match the upstream library, which exposes these as mutable package-level variables rather than untyped constants.

Functions

This section is empty.

Types

type Package

type Package struct {
	Type    string
	Name    string
	Version string
}

Package is a parsed PURL restricted to the types this command supports. Name is the registry-form name (npm scope prefix retained, PEP 503 canonical for pypi, maven "group:artifact" coordinate). Version may be empty when the PURL does not include one.

func Parse

func Parse(s string) (Package, error)

Parse converts a PURL string into a supported Package. It returns an error on parse failures, unsupported types, or type-specific validation failures (for example a maven PURL without a namespace).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL