deps

package
v0.0.0-...-ca9423e Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package deps defines data structures and functions for recording the dependencies between packages.

Index

Constants

This section is empty.

Variables

View Source
var (
	Package_Type_name = map[int32]string{
		0: "UNKNOWN",
		1: "STDLIB",
		2: "LIBRARY",
		3: "PROGRAM",
	}
	Package_Type_value = map[string]int32{
		"UNKNOWN": 0,
		"STDLIB":  1,
		"LIBRARY": 2,
		"PROGRAM": 3,
	}
)

Enum value maps for Package_Type.

Functions

func HasDomain

func HasDomain(ip string) (string, bool)

HasDomain returns the first path component of the specified import path, and reports whether that prefix is a domain name.

func Hash

func Hash(r io.Reader) []byte

Hash produces a SHA-256 digest of the contents of r.

func IsLocalPackage

func IsLocalPackage(pkg string) bool

IsLocalPackage reports whether the specified import path is local.

func IsNonPackage

func IsNonPackage(path string) bool

IsNonPackage reports whether path is a special directory that should not be considered as a package. This is specific to Go.

func IsVendor

func IsVendor(path string) bool

IsVendor reports whether the specified path is in a vendor/ directory.

func ModuleName

func ModuleName(path string) (string, bool)

ModuleName reports whether the specified directory contains a go.mod file, and if so reports the module name declared therein.

Types

type Deps

type Deps struct {
	Repositories []*Repo `protobuf:"bytes,1,rep,name=repositories,proto3" json:"repositories,omitempty"`
	// contains filtered or unexported fields
}

Deps records dependency information for a collection of repositories.

func (*Deps) Descriptor deprecated

func (*Deps) Descriptor() ([]byte, []int)

Deprecated: Use Deps.ProtoReflect.Descriptor instead.

func (*Deps) GetRepositories

func (x *Deps) GetRepositories() []*Repo

func (*Deps) ProtoMessage

func (*Deps) ProtoMessage()

func (*Deps) ProtoReflect

func (x *Deps) ProtoReflect() protoreflect.Message

func (*Deps) Reset

func (x *Deps) Reset()

func (*Deps) String

func (x *Deps) String() string

type File

type File struct {

	// The path of the file relative to the enclosing repository root.
	RepoPath string `protobuf:"bytes,1,opt,name=repo_path,json=repoPath,proto3" json:"repo_path,omitempty"`
	// A hash of the content of the file (sha256).
	Digest []byte `protobuf:"bytes,2,opt,name=digest,proto3" json:"digest,omitempty"`
	// contains filtered or unexported fields
}

func (*File) Descriptor deprecated

func (*File) Descriptor() ([]byte, []int)

Deprecated: Use File.ProtoReflect.Descriptor instead.

func (*File) GetDigest

func (x *File) GetDigest() []byte

func (*File) GetRepoPath

func (x *File) GetRepoPath() string

func (*File) ProtoMessage

func (*File) ProtoMessage()

func (*File) ProtoReflect

func (x *File) ProtoReflect() protoreflect.Message

func (*File) Reset

func (x *File) Reset()

func (*File) String

func (x *File) String() string

type Options

type Options struct {
	HashSourceFiles   bool   `json:"hashSourceFiles"`   // record source file digests
	UseImportComments bool   `json:"useImportComments"` // use import comments to name packages
	TrimRepoPrefix    bool   `json:"trimRepoPrefix"`    // trim the repository prefix from each package
	StandardLibrary   bool   `json:"standardLibrary"`   // treat the inputs as standard libraries
	PackagePrefix     string `json:"packagePrefix"`     // attribute this package prefix to repo contents
}

Options control the behaviour of the Load function. A nil *Options behaves as a zero-valued Options struct.

type Package

type Package struct {
	Name       string       `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`                               // the simple name of the package (foo)
	ImportPath string       `protobuf:"bytes,2,opt,name=import_path,json=importPath,proto3" json:"import_path,omitempty"` // the import path of the package (github.com/bar/foo)
	Type       Package_Type `protobuf:"varint,5,opt,name=type,proto3,enum=deps.Package_Type" json:"type,omitempty"`       // the type of package this is
	Imports    []string     `protobuf:"bytes,3,rep,name=imports,proto3" json:"imports,omitempty"`                         // import paths of direct dependencies
	Sources    []*File      `protobuf:"bytes,4,rep,name=sources,proto3" json:"sources,omitempty"`                         // the source files comprising the package
	// contains filtered or unexported fields
}

func (*Package) Descriptor deprecated

func (*Package) Descriptor() ([]byte, []int)

Deprecated: Use Package.ProtoReflect.Descriptor instead.

func (*Package) GetImportPath

func (x *Package) GetImportPath() string

func (*Package) GetImports

func (x *Package) GetImports() []string

func (*Package) GetName

func (x *Package) GetName() string

func (*Package) GetSources

func (x *Package) GetSources() []*File

func (*Package) GetType

func (x *Package) GetType() Package_Type

func (*Package) ProtoMessage

func (*Package) ProtoMessage()

func (*Package) ProtoReflect

func (x *Package) ProtoReflect() protoreflect.Message

func (*Package) Reset

func (x *Package) Reset()

func (*Package) String

func (x *Package) String() string

type Package_Type

type Package_Type int32

Classify the package type according to its role, if known.

const (
	Package_UNKNOWN Package_Type = 0 // the package type is not known
	Package_STDLIB  Package_Type = 1 // this is a standard library package
	Package_LIBRARY Package_Type = 2 // this is a library package
	Package_PROGRAM Package_Type = 3 // this is an executable
)

func PackageType

func PackageType(pkg *build.Package) Package_Type

PackageType classifies pkg based on its build metadata.

func (Package_Type) Descriptor

func (Package_Type) Enum

func (x Package_Type) Enum() *Package_Type

func (Package_Type) EnumDescriptor deprecated

func (Package_Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use Package_Type.Descriptor instead.

func (Package_Type) Number

func (Package_Type) String

func (x Package_Type) String() string

func (Package_Type) Type

type PathLabelMap

type PathLabelMap map[string]string

A PathLabelMap maintains an association between paths and labels, and assigns subpaths that do not have their own labels a label based on the nearest enclosing parent.

func (PathLabelMap) Add

func (p PathLabelMap) Add(path, label string)

Add adds path to the map with the specified label.

func (PathLabelMap) Find

func (p PathLabelMap) Find(path string) (string, bool)

Find looks up the label for path, returning either the path's own label if one is defined, or an extension of the nearest enclosing parent path with a label. Find returns "", false if no matching label is found.

type Remote

type Remote struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // the name of the remote ref
	Url  string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`   // the remote fetch URL
	// contains filtered or unexported fields
}

A Remote records information about a Git remote.

func (*Remote) Descriptor deprecated

func (*Remote) Descriptor() ([]byte, []int)

Deprecated: Use Remote.ProtoReflect.Descriptor instead.

func (*Remote) GetName

func (x *Remote) GetName() string

func (*Remote) GetUrl

func (x *Remote) GetUrl() string

func (*Remote) ProtoMessage

func (*Remote) ProtoMessage()

func (*Remote) ProtoReflect

func (x *Remote) ProtoReflect() protoreflect.Message

func (*Remote) Reset

func (x *Remote) Reset()

func (*Remote) String

func (x *Remote) String() string

type Repo

type Repo struct {

	// The location where this repository was read from for diagnostic purposes;
	// usually the path of either a directory (for a local repo) or an archive
	// file.
	From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
	// The remotes defined by this repository.
	Remotes []*Remote `protobuf:"bytes,2,rep,name=remotes,proto3" json:"remotes,omitempty"`
	// The source packages defined inside this repository.
	Packages []*Package `protobuf:"bytes,3,rep,name=packages,proto3" json:"packages,omitempty"`
	// contains filtered or unexported fields
}

Repo records information about a single repository.

func (*Repo) Descriptor deprecated

func (*Repo) Descriptor() ([]byte, []int)

Deprecated: Use Repo.ProtoReflect.Descriptor instead.

func (*Repo) GetFrom

func (x *Repo) GetFrom() string

func (*Repo) GetPackages

func (x *Repo) GetPackages() []*Package

func (*Repo) GetRemotes

func (x *Repo) GetRemotes() []*Remote

func (*Repo) ProtoMessage

func (*Repo) ProtoMessage()

func (*Repo) ProtoReflect

func (x *Repo) ProtoReflect() protoreflect.Message

func (*Repo) Reset

func (x *Repo) Reset()

func (*Repo) String

func (x *Repo) String() string

Jump to

Keyboard shortcuts

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