graph

package
Version: v0.2.1-0...-c8d20ea Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2013 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

type Graph struct {
	// If "a" imports "b", DependsOn["a"]["b"] == true
	DependsOn map[string]map[string]bool

	// If "a" imports "b", UsedBy["b"]["a"] == true
	UsedBy map[string]map[string]bool

	// Package["import/path"] = &Package{...}
	Package map[string]*Package

	// Repository["repo/path"] = &Repository{...}
	Repository map[string]*Repository

	// When this graph was last updated.
	LastScan time.Time
}

Graph stores the dependency graph of packages.

func New

func New() *Graph

func (*Graph) FindRepo

func (g *Graph) FindRepo(key string) (*Repository, error)

FindRepo attempts to find a repository with the given key. If a unique repository is found it is returned, an error otherwise.

func (*Graph) RepoDeps

func (g *Graph) RepoDeps(repo *Repository) ([]*Repository, error)

RepoDeps returns a list of the repositories which contain packages upon which packages in the given repository depend.

func (*Graph) RepoUsers

func (g *Graph) RepoUsers(repo *Repository) ([]*Repository, error)

RepoUsers returns a list of the repositories which contain packages which depend on packages in the given repository.

func (*Graph) Scan

func (g *Graph) Scan(target string) error

Scan scans the named packages and updats their records in the dependency graph. To scan everything, use Scan("all").

type Package

type Package struct {
	// General
	Dir        string // directory containing package sources
	ImportPath string // import path of package in dir
	Name       string // package name
	Target     string // install path
	Goroot     bool   // is this package in the Go root?
	Standard   bool   // is this package part of the standard Go library?
	Root       string // Go root or Go path dir containing this package
	Incomplete bool   // this package or a dependency has an error

	// Package files
	GoFiles      []string // .go files
	TestGoFiles  []string // _test.go files
	XTestGoFiles []string // currently ignored

	// Package imports
	Imports      []string // import paths used by this package
	TestImports  []string // import paths used by _test.go files in this package
	XTestImports []string // currently ignored

	// Rx specific
	RepoRoot string
}

Package is a subset of cmd/go.Package Parsed from `go list`

func (*Package) DetectVCS

func (p *Package) DetectVCS() (vcsFound, root string)

DetectVCS attempts to detect which version control system is hosting the package, or "" if none is found. If two are detected, the one with the longer root path is chosen. If more than one have identical length paths, the result is undefined.

func (*Package) IsBinary

func (p *Package) IsBinary() bool

IsBinary returns true if the package is a binary. A package is a binary iff the name of the package is "main".

func (*Package) IsTestable

func (p *Package) IsTestable() bool

IsTestable returns true if the package is testable. A package is testable iff there are one or more _test.go files.

func (*Package) Keep

func (p *Package) Keep() bool

Keep returns true if the package should be processed by rx. Packages are not processed if they are in GOROOT, a part of the standard library, or had an error when processing them.

type Repository

type Repository struct {
	Root     string   // directory containing the repository
	VCS      string   // version control system
	Packages []string // packages contained in this repository
}

A Repository is a version-controlled directory containing one or more packages.

func (*Repository) Downgrades

func (r *Repository) Downgrades() (TagList, error)

func (*Repository) Head

func (r *Repository) Head() (string, error)

func (*Repository) String

func (r *Repository) String() string

String returns the import pattern matching all packages

func (*Repository) Tags

func (r *Repository) Tags() (TagList, error)

func (*Repository) ToRev

func (r *Repository) ToRev(rev string) error

func (*Repository) Upgrades

func (r *Repository) Upgrades() (TagList, error)

type Tag

type Tag struct {
	Name string
	Rev  string
}

type TagList

type TagList []Tag

Jump to

Keyboard shortcuts

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