pkg

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: MPL-2.0 Imports: 2 Imported by: 85

Documentation

Overview

Package pkg defines a generic software package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	Name  string
	Email string
}

An Author is a package author.

type Deps

type Deps map[ID]Package

type File

type File struct {
	Path       string
	Qualifiers string // For example, Go build tags
}

TODO: Implement file-level granularity?

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.

func (*ID) String

func (id *ID) String() string

type Import

type Import struct {
	Target   string
	Resolved ID
}

An Import is a combination of a (potentially unresolved) dependency target and the exact resolved pkg.ID of the dependency.

type Imports

type Imports []Import

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

	Imports []Import
}

A Package represents a single package at a semantic level. The precise definition of "package" will vary from language to language.

type Qualifier

type Qualifier int
const (
	Production Qualifier = iota
	Development
	Test
)

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 (
	Ant       Type // Apache Ant (https://ant.apache.org)
	Bower          // Bower (https://bower.io)
	Buck           // Buck (https://buckbuild.com)
	Bazel          // Bazel (https://bazel.build/)
	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/)
	RPM            // RPM https://rpm.org/
	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

func ParseType(key string) (Type, error)

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.

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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