Documentation
¶
Overview ¶
Package core provides shared types and the parser registry.
Index ¶
- func AnyMatch(matchers ...func(string) bool) func(string) bool
- func EstimateDeps(size int) int
- func ExactMatch(names ...string) func(string) bool
- func ExtractQuotedValue(line, prefix string) (string, bool)
- func ForEachLine(content string, fn func(line string) bool)
- func GlobMatch(pattern string) func(string) bool
- func IdentifyParser(filename string) (Parser, string, Kind)
- func ParseDockerImage(image string) (name, version string)
- func PrefixMatch(prefixes ...string) func(string) bool
- func Register(ecosystem string, kind Kind, parser Parser, match func(string) bool)
- func SuffixMatch(suffixes ...string) func(string) bool
- func SupportedEcosystems() []string
- type Dependency
- type Kind
- type Match
- type ParseError
- type Parser
- type Registration
- type Scope
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstimateDeps ¶
EstimateDeps estimates the number of dependencies based on file size.
func ExactMatch ¶
ExactMatch returns a matcher for exact filename matches.
func ExtractQuotedValue ¶
ExtractQuotedValue extracts value from lines like: key = "value"
func ForEachLine ¶
ForEachLine iterates over lines in content without allocating a slice.
func IdentifyParser ¶
IdentifyParser returns the first matching parser for a filename.
func ParseDockerImage ¶
ParseDockerImage parses a Docker image reference like "nginx:1.19" or "nginx@sha256:abc". When both tag and digest are present (nginx:1.19@sha256:abc), the digest is used as version and the tag is stripped from the name.
func PrefixMatch ¶
PrefixMatch returns a matcher for prefix matches.
func SuffixMatch ¶
SuffixMatch returns a matcher for suffix matches.
func SupportedEcosystems ¶
func SupportedEcosystems() []string
SupportedEcosystems returns all registered ecosystem types.
Types ¶
type Dependency ¶
type Dependency struct {
Name string
Version string
Scope Scope
Integrity string
Direct bool
PURL string
RegistryURL string
}
Dependency represents a parsed dependency from a manifest or lockfile.
type Match ¶
Match represents a file type match.
func IdentifyAllParsers ¶
IdentifyAllParsers returns all matching parsers for a filename.
type ParseError ¶
ParseError is returned when parsing fails.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
func (*ParseError) Unwrap ¶
func (e *ParseError) Unwrap() error
type Parser ¶
type Parser interface {
Parse(filename string, content []byte) ([]Dependency, error)
}
Parser is the interface implemented by all manifest parsers.