From c2491a6c4628ccecbb78a057f0ea269bb73db69e Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Wed, 31 May 2017 14:48:48 -0500 Subject: [PATCH] document Analyzer and Project --- analyzer.go | 4 ++++ project.go | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/analyzer.go b/analyzer.go index a0a83a8036..f2f17996c4 100644 --- a/analyzer.go +++ b/analyzer.go @@ -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 } diff --git a/project.go b/project.go index 93a0ad3b1e..309316fb34 100644 --- a/project.go +++ b/project.go @@ -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