Documentation
¶
Overview ¶
Package pkg defines a generic software package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AllTypes = []Type{ Ant, Bower, Buck, Carthage, Clojure, Cocoapods, Composer, Debian, Go, Gradle, Haskell, Maven, NodeJS, NuGet, OkBuck, Python, Ruby, Rust, Scala, Raw, }
AllTypes enumerates all package types.
Functions ¶
This section is empty.
Types ¶
type ID ¶
type ID struct {
// Type, Name, and Revision describe _what_ package is being identified. The
// combination of these three fields uniquely identifies a single package on
// a semantic level.
Type Type
Name string
Revision string
// Location is _where_ the package is found. For example, an NPM package with
// the same name and revision may be found in two different registries.
Location string
}
An ID uniquely identifies a package.
type Import ¶
An Import is a combination of a (potentially unresolved) dependency target and the exact resolved pkg.ID of the dependency.
type LicenseExpr ¶
type LicenseExpr string
A LicenseExpr is a raw string containing a SPDX-like license expression.
LicenseExprs are not exactly the same as SPDX expressions, because they may contain license identifiers that are not valid SPDX licenses.
type Package ¶
type Package struct {
ID ID
Authors []Author `json:",omitempty"`
Description string `json:",omitempty"`
DeclaredLicenses []LicenseExpr `json:",omitempty"`
ProjectURL string `json:",omitempty"` // URL of the project (often the "homepage" URL)
SourceCodeURL string `json:",omitempty"` // URL at which source code can be obtained (often a git repository)
RegistryURL string `json:",omitempty"` // URL of the package's registry (e.g. if using private registries)
DownloadURL string `json:",omitempty"` // URL at which binaries or compiled bundles can be downloaded
// These are specific to the package's build, and tell us metadata about _how_
// this package was used.
BuildTool string // Example: `yarn`
OriginManifest string // Example: `./package.json`
Registry string // Example: `npm:npmjs.org`
Imports []Import
// A package's resolution strategy is set by the analyzer which resolves it,
// and the meaning will vary depending on the analyzer used.
Strategy string
}
A Package represents a single package at a semantic level. The precise definition of "package" will vary from language to language.
type Type ¶
type Type int
The Type of a Package indicates the ecosystem of the package. Generally, this corresponds to tool, registry, or language.
const ( Invalid Type = iota // Placeholder Ant // Apache Ant (https://ant.apache.org) Bower // Bower (https://bower.io) Buck // Buck (https://buckbuild.com) Carthage // Carthage (https://github.com/Carthage/Carthage) Clojure // Clojure (https://clojure.org) Cocoapods // Cocoapods (https://cocoapods.org) Composer // Composer (https://getcomposer.org) Debian // Debian (https://manpages.debian.org/stretch/dpkg/dpkg.1.en.html) Go // dep (https://github.com/golang/dep), glide (https://github.com/Masterminds/glide), godep (https://github.com/tools/godep), govendor (experimental, https://github.com/kardianos/govendor), vndr (https://github.com/LK4D4/vndr), gomodules (https://github.com/golang/go/wiki/Modules) Git // git Gradle // Gradle (https://gradle.org) Haskell // Haskell with cabal-install (https://www.haskell.org/cabal/) or stack (https://www.haskellstack.org/) Maven // Maven (https://maven.apache.org) NodeJS // NPM (https://www.npmjs.com), Yarn (https://yarnpkg.com) NuGet // NuGet (https://www.nuget.org) OkBuck // OkBuck (https://github.com/uber/okbuck) Python // Pip (https://pip.pypa.io), Pipenv (https://pipenv.readthedocs.io/en/latest/) Ruby // Bundler (https://bundler.io) Rust // Cargo (https://github.com/rust-lang/cargo) Scala // SBT (https://www.scala-sbt.org) Raw // Unsupported languages )
Supported package types.
func ParseType ¶
ParseType returns the canonical package type given a string key. TODO: if we got rid of aliases, we could use `go generate` with https://github.com/alvaroloes/enumer.