Documentation ¶
Overview ¶
Package dep provides data structures for representing dependency types.
Index ¶
- type AttrKey
- type Type
- func (t *Type) AddAttr(key AttrKey, value string)
- func (t *Type) Clone() Type
- func (t Type) Compare(other Type) int
- func (t Type) Equal(other Type) bool
- func (t *Type) GetAttr(key AttrKey) (value string, ok bool)
- func (t *Type) HasAttr(key AttrKey) bool
- func (t Type) IsRegular() bool
- func (t Type) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttrKey ¶
type AttrKey int8
AttrKey represents an attribute key that may be applied to a Type.
Its specific values are an implementation detail of this package; only use the named constants in client code.
const ( // Dev indicates the dependency is required to develop a package. // Its value is ignored; its presence is the indicator. Dev AttrKey = -0x01 // Opt indicates the dependency is optional; it is not // necessary but may provide additional functionality. // Its value is ignored; its presence is the indicator. Opt AttrKey = -0x02 // Test indicates the dependency is required to build a package's tests. // Its value is ignored; its presence is the indicator. Test AttrKey = -0x04 // XTest indicates the dependency is from a Go XTest. XTest AttrKey = 1 // Framework indicates the dependency belongs to a NuGet target framework. Framework AttrKey = 2 // Scope indicates the scope of a dependency. // Its value should be one of these: // - For Maven dependencies: provided, runtime, system, import // - For Cargo dependencies: build // - For NPM dependencies: peer, bundle // Maven scopes 'compile' and 'test' are not valid here. They are // modeled as regular dependency and test dependency. NPM scope 'bundle' // means the dependency was declared as such, not necessarily that it // was found inside the tarball. Scope AttrKey = 3 // Attribute keys for Maven dependencies. // // MavenClassifier and MavenArtifactType are part of Maven dependency key. // They are both free text defined by Maven package maintainers. // // MavenDependencyOrigin indicates the origin of a Maven dependency. // Its value should be one of these: import, management, parent. // // MavenExclusions holds the list of exclusions for the given dependency. // Each item of the list is separated by | (a pipe) and is of the form // groupID:artifactID where groupID and/or artifactID may be a * (wildcard). MavenClassifier AttrKey = 4 MavenArtifactType AttrKey = 5 MavenDependencyOrigin AttrKey = 6 MavenExclusions AttrKey = 9 // EnabledDependencies represents which optional dependencies // are enabled by this dependent in its dependency. // // In Cargo, this is a comma-separated list of features/optional // dependencies that are activated by this dependency. EnabledDependencies AttrKey = 7 // KnownAs is the name under which this dependency is referenced // by the package. KnownAs AttrKey = 8 // Environment holds conditions used to filter dependencies according to // local context. // // In PyPI this holds a PEP 508 environment marker. Environment AttrKey = 10 // Selector is used in the context of resolved graphs and flags whether // the dependency is the selector of the concrete version. // In the case of NPM, this is set for all the edges that are not marked // as dedup in the install tree. // For Maven, this is set for all the edges that would appear in the // dependency tree. Selector AttrKey = 11 )
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type indicates the type of a dependency edge.
The zero value of Type is a regular dependency. Attributes may be added to a Type to annotate it with extra details or restrictions.
func NewType ¶
NewType constructs a Type with the given attributes set. This is a convenience constructor for Types with value-less attributes.
func (Type) Compare ¶
Compare returns -1, 0 or 1 depending on whether the Type is ordered before, equal to or after the other Type.
func (*Type) HasAttr ¶
HasAttr reports whether the type has the given attribute. This is a convenience method when the key is used as a flag.