Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
Merge pull request #690 from jmank88/analyzer_project_docs
Browse files Browse the repository at this point in the history
Document Analyzer and Project
  • Loading branch information
sdboyer authored Jun 5, 2017
2 parents dc2413a + c2491a6 commit d31c621
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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
}
3 changes: 2 additions & 1 deletion project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d31c621

Please sign in to comment.