This commit is contained in:
sam boyer 2018-07-04 01:40:34 -04:00
Родитель 08a43497b3
Коммит 812b8c103f
5 изменённых файлов: 9 добавлений и 32 удалений

Просмотреть файл

@ -203,7 +203,7 @@ func (cmd *ensureCommand) Run(ctx *dep.Ctx, args []string) error {
sums[string(lp.Ident().ProjectRoot)] = lp.(verify.VerifiableProject).Digest
}
status, err := verify.VerifyDepTree(vendorDir, sums)
status, err := verify.CheckDepTree(vendorDir, sums)
if err != nil {
ctx.Err.Printf("Error while verifying vendor directory: %q", err.Error())
os.Exit(1)

Просмотреть файл

@ -96,28 +96,6 @@ func (m simpleRootManifest) IgnoredPackages() *pkgtree.IgnoredRuleset {
func (m simpleRootManifest) RequiredPackages() map[string]bool {
return m.req
}
func (m simpleRootManifest) dup() simpleRootManifest {
m2 := simpleRootManifest{
c: make(ProjectConstraints, len(m.c)),
ovr: make(ProjectConstraints, len(m.ovr)),
req: make(map[string]bool, len(m.req)),
}
for k, v := range m.c {
m2.c[k] = v
}
for k, v := range m.ovr {
m2.ovr[k] = v
}
for k, v := range m.req {
m2.req[k] = v
}
// IgnoredRulesets are immutable, and safe to reuse.
m2.ig = m.ig
return m2
}
// prepManifest ensures a manifest is prepared and safe for use by the solver.
// This is mostly about ensuring that no outside routine can modify the manifest

Просмотреть файл

@ -373,7 +373,7 @@ func ParseVersionedDigest(input string) (VersionedDigest, error) {
return vd, nil
}
// VerifyDepTree verifies a dependency tree according to expected digest sums,
// CheckDepTree verifies a dependency tree according to expected digest sums,
// and returns an associative array of file system nodes and their respective
// vendor status conditions.
//
@ -383,7 +383,7 @@ func ParseVersionedDigest(input string) (VersionedDigest, error) {
// platform where the file system path separator is a character other than
// solidus, one particular dependency would be represented as
// "github.com/alice/alice1".
func VerifyDepTree(osDirname string, wantDigests map[string]VersionedDigest) (map[string]VendorStatus, error) {
func CheckDepTree(osDirname string, wantDigests map[string]VersionedDigest) (map[string]VendorStatus, error) {
osDirname = filepath.Clean(osDirname)
// Ensure top level pathname is a directory

Просмотреть файл

@ -173,7 +173,7 @@ func TestVerifyDepTree(t *testing.T) {
}
}
status, err := VerifyDepTree(vendorRoot, wantDigests)
status, err := CheckDepTree(vendorRoot, wantDigests)
if err != nil {
t.Fatal(err)
}
@ -214,7 +214,7 @@ func TestVerifyDepTree(t *testing.T) {
}
}
status, err := VerifyDepTree(vendorRoot, wantDigests)
status, err := CheckDepTree(vendorRoot, wantDigests)
if err != nil {
t.Fatal(err)
}
@ -252,7 +252,7 @@ func BenchmarkVerifyDepTree(b *testing.B) {
prefix := filepath.Join(os.Getenv("GOPATH"), "src")
for i := 0; i < b.N; i++ {
_, err := VerifyDepTree(prefix, nil)
_, err := CheckDepTree(prefix, nil)
if err != nil {
b.Fatal(err)
}

Просмотреть файл

@ -404,7 +404,6 @@ type DeltaWriter struct {
pruneOptions gps.CascadingPruneOptions
vendorDir string
changed map[gps.ProjectRoot]changeType
status map[string]verify.VendorStatus
behavior VendorBehavior
}
@ -425,7 +424,7 @@ const (
// directory by writing out only those projects that actually need to be written
// out - they have changed in some way, or they lack the necessary hash
// information to be verified.
func NewDeltaWriter(oldLock, newLock *Lock, status map[string]verify.VendorStatus, prune gps.CascadingPruneOptions, vendorDir string, behavior VendorBehavior) (DepWriter, error) {
func NewDeltaWriter(oldLock, newLock *Lock, status map[string]verify.VendorStatus, prune gps.CascadingPruneOptions, vendorDir string, behavior VendorBehavior) (TreeWriter, error) {
sw := &DeltaWriter{
lock: newLock,
pruneOptions: prune,
@ -674,9 +673,9 @@ func (dw *DeltaWriter) PrintPreparedActions(output *log.Logger, verbose bool) er
return nil
}
// A DepWriter is responsible for writing important dep states to disk -
// A TreeWriter is responsible for writing important dep states to disk -
// Gopkg.lock, vendor, and possibly Gopkg.toml.
type DepWriter interface {
type TreeWriter interface {
PrintPreparedActions(output *log.Logger, verbose bool) error
Write(path string, sm gps.SourceManager, examples bool, logger *log.Logger) error
}