pkg

package
v0.7.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2018 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

AllTypes enumerates all package types.

Functions

This section is empty.

Types

type Author

type Author struct {
	Name  string
	Email string
}

An Author is a package author.

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 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 (
	Ant       Type = iota // Apache Ant (https://ant.apache.org)
	Bower                 // Bower (https://bower.io)
	Cocoapods             // Cocoapods (https://cocoapods.org)
	Composer              // Composer (https://getcomposer.org)
	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)
	Git                   // git
	Gradle                // Gradle (https://gradle.org)
	Maven                 // Maven (https://maven.apache.org)
	NodeJS                // NPM (https://www.npmjs.com), Yarn (https://yarnpkg.com)
	NuGet                 // NuGet (https://www.nuget.org)
	Python                // Pip (https://pip.pypa.io)
	Ruby                  // Bundler (https://bundler.io)
	Scala                 // SBT (https://www.scala-sbt.org)
)

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