зеркало из https://github.com/golang/dep.git
document Analyzer and Project
This commit is contained in:
Родитель
c36bccf4b8
Коммит
c2491a6c46
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/golang/dep/internal/gps"
|
||||
)
|
||||
|
||||
// Analyzer implements gps.ProjectAnalyzer.
|
||||
type Analyzer struct{}
|
||||
|
||||
// HasDepMetadata determines if a dep manifest exists at the specified path.
|
||||
|
@ -21,6 +22,8 @@ func (a Analyzer) HasDepMetadata(path string) bool {
|
|||
return err == nil && fileOK
|
||||
}
|
||||
|
||||
// DeriveManifestAndLock reads and returns the manifest at path/ManifestName or nil if one is not found.
|
||||
// The Lock is always nil for now.
|
||||
func (a Analyzer) DeriveManifestAndLock(path string, n gps.ProjectRoot) (gps.Manifest, gps.Lock, error) {
|
||||
if !a.HasDepMetadata(path) {
|
||||
return nil, nil, nil
|
||||
|
@ -42,6 +45,7 @@ func (a Analyzer) DeriveManifestAndLock(path string, n gps.ProjectRoot) (gps.Man
|
|||
return m, nil, nil
|
||||
}
|
||||
|
||||
// Info returns the name and version of this ProjectAnalyzer.
|
||||
func (a Analyzer) Info() (string, int) {
|
||||
return "dep", 1
|
||||
}
|
||||
|
|
|
@ -39,13 +39,14 @@ func findProjectRoot(from string) (string, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// A Project holds a Manifest and optional Lock for a project.
|
||||
type Project struct {
|
||||
// AbsRoot is the absolute path to the root directory of the project.
|
||||
AbsRoot string
|
||||
// ImportRoot is the import path of the project's root directory.
|
||||
ImportRoot gps.ProjectRoot
|
||||
Manifest *Manifest
|
||||
Lock *Lock
|
||||
Lock *Lock // Optional
|
||||
}
|
||||
|
||||
// MakeParams is a simple helper to create a gps.SolveParameters without setting
|
||||
|
|
Загрузка…
Ссылка в новой задаче