Tests are now almost completely working, after updating all the outputs
to the new lock format. There is also an assortment of other fixes in
here, mostly related to fixing nil pointer panics, that were uncovered
by fixing up these tests.
This commit is contained in:
sam boyer 2018-07-03 01:39:02 -04:00
Родитель 6b47f58a62
Коммит f00e82813f
82 изменённых файлов: 697 добавлений и 525 удалений

2
Gopkg.lock сгенерированный
Просмотреть файл

@ -128,7 +128,7 @@
"github.com/pkg/errors",
"github.com/sdboyer/constext",
"golang.org/x/sync/errgroup",
"gopkg.in/yaml.v2",
"gopkg.in/yaml.v2"
]
solver-name = "gps-cdcl"
solver-version = 1

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

@ -278,6 +278,7 @@ func (cmd *ensureCommand) runDefault(ctx *dep.Ctx, args []string, p *dep.Project
return err
}
var solve bool
lock := p.ChangedLock
if lock != nil {
lsat := verify.LockSatisfiesInputs(p.Lock, p.Manifest, params.RootPackageTree)
@ -298,21 +299,26 @@ func (cmd *ensureCommand) runDefault(ctx *dep.Ctx, args []string, p *dep.Project
}
ctx.Out.Println()
}
solver, err := gps.Prepare(params, sm)
if err != nil {
return errors.Wrap(err, "prepare solver")
}
solution, err := solver.Solve(context.TODO())
if err != nil {
return handleAllTheFailuresOfTheWorld(err)
}
lock = dep.LockFromSolution(solution, p.Manifest.PruneOptions)
solve = true
} else if cmd.noVendor {
// The user said not to touch vendor/, so definitely nothing to do.
return nil
}
} else {
solve = true
}
if solve {
solver, err := gps.Prepare(params, sm)
if err != nil {
return errors.Wrap(err, "prepare solver")
}
solution, err := solver.Solve(context.TODO())
if err != nil {
return handleAllTheFailuresOfTheWorld(err)
}
lock = dep.LockFromSolution(solution, p.Manifest.PruneOptions)
}
dw, err := dep.NewDeltaWriter(p.Lock, lock, <-statchan, p.Manifest.PruneOptions, filepath.Join(p.AbsRoot, "vendor"))
@ -414,35 +420,29 @@ func (cmd *ensureCommand) runAdd(ctx *dep.Ctx, args []string, p *dep.Project, sm
return err
}
// We'll need to discard this prepared solver as later work changes params,
// but solver preparation is cheap and worth doing up front in order to
// perform the fastpath check of hash comparison.
solver, err := gps.Prepare(params, sm)
if err != nil {
return errors.Wrap(err, "fastpath solver prepare")
}
rm, _ := params.RootPackageTree.ToReachMap(true, true, false, p.Manifest.IgnoredPackages())
// Compile unique sets of 1) all external packages imported or required, and
// 2) the project roots under which they fall.
exmap := make(map[string]bool)
exrmap := make(map[gps.ProjectRoot]bool)
for _, ex := range append(rm.FlattenFn(paths.IsStandardImportPath), p.Manifest.Required...) {
exmap[ex] = true
root, err := sm.DeduceProjectRoot(ex)
if err != nil {
// This should be very uncommon to hit, as it entails that we
// couldn't deduce the root for an import, but that some previous
// solve run WAS able to deduce the root. It's most likely to occur
// if the user has e.g. not connected to their organization's VPN,
// and thus cannot access an internal go-get metadata service.
return errors.Wrapf(err, "could not deduce project root for %s", ex)
if p.ChangedLock != nil {
for _, imp := range p.ChangedLock.InputImports() {
exmap[imp] = true
}
} else {
// The only time we'll hit this branch is if
rm, _ := p.RootPackageTree.ToReachMap(true, true, false, p.Manifest.IgnoredPackages())
for _, imp := range rm.FlattenFn(paths.IsStandardImportPath) {
exmap[imp] = true
}
for imp := range p.Manifest.RequiredPackages() {
exmap[imp] = true
}
exrmap[root] = true
}
//exrmap, err := p.GetDirectDependencyNames(sm)
//if err != nil {
//return err
//}
// Note: these flags are only partially used by the latter parts of the
// algorithm; rather, it relies on inference. However, they remain in their
// entirety as future needs may make further use of them, being a handy,
@ -620,7 +620,7 @@ func (cmd *ensureCommand) runAdd(ctx *dep.Ctx, args []string, p *dep.Project, sm
}
// Re-prepare a solver now that our params are complete.
solver, err = gps.Prepare(params, sm)
solver, err := gps.Prepare(params, sm)
if err != nil {
return errors.Wrap(err, "fastpath solver prepare")
}

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

@ -168,8 +168,6 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
return errors.Wrap(err, "init failed: unable to recalculate the lock digest")
}
//p.Lock.SolveMeta.InputsDigest = s.HashInputs()
// Pass timestamp (yyyyMMddHHmmss format) as suffix to backup name.
vendorbak, err := dep.BackupVendor(filepath.Join(root, "vendor"), time.Now().Format("20060102150405"))
if err != nil {

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

@ -11,7 +11,6 @@ import (
"github.com/golang/dep"
"github.com/golang/dep/gps"
"github.com/golang/dep/gps/verify"
fb "github.com/golang/dep/internal/feedback"
"github.com/golang/dep/internal/importers"
"golang.org/x/sync/errgroup"
@ -168,7 +167,7 @@ func (a *rootAnalyzer) DeriveManifestAndLock(dir string, pr gps.ProjectRoot) (gp
func (a *rootAnalyzer) FinalizeRootManifestAndLock(m *dep.Manifest, l *dep.Lock, ol dep.Lock) {
// Iterate through the new projects in solved lock and add them to manifest
// if they are direct deps and log feedback for all the new projects.
diff := verify.DiffLocks(&ol, l)
diff := fb.DiffLocks(&ol, l)
bi := fb.NewBrokenImportFeedback(diff)
bi.LogFeedback(a.ctx.Err)
for _, y := range l.Projects() {

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

@ -7,7 +7,6 @@ package main
import (
"bytes"
"context"
"encoding/hex"
"encoding/json"
"flag"
"fmt"
@ -779,7 +778,6 @@ func newRawMetadata(metadata *dep.SolveMeta) rawDetailMetadata {
return rawDetailMetadata{
AnalyzerName: metadata.AnalyzerName,
AnalyzerVersion: metadata.AnalyzerVersion,
InputsDigest: hex.EncodeToString(metadata.InputsDigest),
SolverName: metadata.SolverName,
SolverVersion: metadata.SolverVersion,
}
@ -921,6 +919,10 @@ func (cmd *statusCommand) runStatusAll(ctx *dep.Ctx, out outputter, p *dep.Proje
sort.Slice(slp, func(i, j int) bool {
return slp[i].Ident().Less(slp[j].Ident())
})
slcp := p.ChangedLock.Projects()
sort.Slice(slcp, func(i, j int) bool {
return slcp[i].Ident().Less(slcp[j].Ident())
})
lsat := verify.LockSatisfiesInputs(p.Lock, p.Manifest, params.RootPackageTree)
if lsat.Passed() {

9
cmd/dep/testdata/harness_tests/ensure/add/all-new-double-spec/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,27 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[[projects]]
branch = "master"
digest = "1:d08235d21a5df95ab12e1eb0191ffe9c4ceb4fa8005f079f6815e8ff507855d3"
name = "github.com/sdboyer/deptesttres"
packages = ["."]
pruneopts = "UT"
revision = "54aaeb0023e1f3dcf5f98f31dd8c565457945a12"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "645b5b52e1bfb9e3db1cefde758485e009edfe5bad611b490582d94467f9c1b0"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptesttres"
]
solver-name = "gps-cdcl"
solver-version = 1

10
cmd/dep/testdata/harness_tests/ensure/add/all-new-double/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,23 +2,31 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[[projects]]
branch = "master"
digest = "1:d62f7f8be8f431ede67fae7f90d75f923dddc627b309b9134ea1db95f0e34e6d"
name = "github.com/sdboyer/deptesttres"
packages = [
".",
"subp"
]
pruneopts = "UT"
revision = "54aaeb0023e1f3dcf5f98f31dd8c565457945a12"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "432bc141db9511df4e1b5754c6c4d8cf4dd8b4f8d5a13fd7d189c17c14e000b7"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptesttres",
"github.com/sdboyer/deptesttres/subp"
]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/ensure/add/all-new-spec/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,27 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[[projects]]
branch = "master"
digest = "1:d08235d21a5df95ab12e1eb0191ffe9c4ceb4fa8005f079f6815e8ff507855d3"
name = "github.com/sdboyer/deptesttres"
packages = ["."]
pruneopts = "UT"
revision = "54aaeb0023e1f3dcf5f98f31dd8c565457945a12"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "645b5b52e1bfb9e3db1cefde758485e009edfe5bad611b490582d94467f9c1b0"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptesttres"
]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/ensure/add/all-new/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,27 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[[projects]]
branch = "master"
digest = "1:d08235d21a5df95ab12e1eb0191ffe9c4ceb4fa8005f079f6815e8ff507855d3"
name = "github.com/sdboyer/deptesttres"
packages = ["."]
pruneopts = "UT"
revision = "54aaeb0023e1f3dcf5f98f31dd8c565457945a12"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "8f0b74fd1169808bd0e31dd7ad6c601c7b8f7ef25eec9e8a45e72b8a384ebb5c"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptesttres"
]
solver-name = "gps-cdcl"
solver-version = 1

12
cmd/dep/testdata/harness_tests/ensure/add/desync/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,26 +2,36 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = ""
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[[projects]]
branch = "master"
digest = "1:0dba41ffdf62b10cbbd79009edceb0eaf635031e854fb456fdd5be154802f8d3"
name = "github.com/sdboyer/deptesttres"
packages = ["."]
pruneopts = ""
revision = "54aaeb0023e1f3dcf5f98f31dd8c565457945a12"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "86240895e0ee5788e7e8bb56e0d77afd58009a491b69f6835e546db9e5dacfcd"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos",
"github.com/sdboyer/deptesttres"
]
solver-name = "gps-cdcl"
solver-version = 1

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

@ -1,2 +1 @@
Warning: Gopkg.lock is out of sync with Gopkg.toml or the project's imports.
Fetching sources...

4
cmd/dep/testdata/harness_tests/ensure/add/errs/double-diff-spec/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -3,13 +3,15 @@
[[projects]]
branch = "master"
digest = "1:d08235d21a5df95ab12e1eb0191ffe9c4ceb4fa8005f079f6815e8ff507855d3"
name = "github.com/sdboyer/deptesttres"
packages = ["."]
pruneopts = "UT"
revision = "54aaeb0023e1f3dcf5f98f31dd8c565457945a12"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "342afd8c8a616d084eb7b67bf3a891710eca3ce5abc3cf60af0dae4ccfdcd001"
input-imports = ["github.com/sdboyer/deptesttres"]
solver-name = "gps-cdcl"
solver-version = 1

2
cmd/dep/testdata/harness_tests/ensure/add/errs/self-add/case2/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -4,6 +4,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7"
input-imports = []
solver-name = "gps-cdcl"
solver-version = 1

4
cmd/dep/testdata/harness_tests/ensure/add/exists-imports/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -3,13 +3,15 @@
[[projects]]
branch = "master"
digest = "1:0dba41ffdf62b10cbbd79009edceb0eaf635031e854fb456fdd5be154802f8d3"
name = "github.com/sdboyer/deptesttres"
packages = ["."]
pruneopts = ""
revision = "54aaeb0023e1f3dcf5f98f31dd8c565457945a12"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "342afd8c8a616d084eb7b67bf3a891710eca3ce5abc3cf60af0dae4ccfdcd001"
input-imports = ["github.com/sdboyer/deptesttres"]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/ensure/add/exists-manifest-constraint/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,27 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[[projects]]
branch = "master"
digest = "1:0dba41ffdf62b10cbbd79009edceb0eaf635031e854fb456fdd5be154802f8d3"
name = "github.com/sdboyer/deptesttres"
packages = ["."]
pruneopts = ""
revision = "54aaeb0023e1f3dcf5f98f31dd8c565457945a12"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "d1fe1d4f4dd98b75908b524bd73d43a4b9e3ce0b9522ea6ce9d6c9ea15190c1d"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptesttres"
]
solver-name = "gps-cdcl"
solver-version = 1

4
cmd/dep/testdata/harness_tests/ensure/default/hasheq-novendor/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,14 +2,16 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c"
input-imports = ["github.com/sdboyer/deptest"]
solver-name = "gps-cdcl"
solver-version = 1

4
cmd/dep/testdata/harness_tests/ensure/default/hasheq/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,14 +2,16 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c"
input-imports = ["github.com/sdboyer/deptest"]
solver-name = "gps-cdcl"
solver-version = 1

16
cmd/dep/testdata/harness_tests/ensure/default/hashneq-novendor-dry/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -1,16 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/sdboyer/deptest"
packages = ["."]
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
# manually modified hash digest, it will not match any known inputs
inputs-digest = "94b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c"
solver-name = "gps-cdcl"
solver-version = 1

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

@ -1,4 +0,0 @@
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "1.0.0"

16
cmd/dep/testdata/harness_tests/ensure/default/hashneq-novendor-dry/initial/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -1,16 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/sdboyer/deptest"
packages = ["."]
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
# manually modified hash digest, it will not match any known inputs
inputs-digest = "94b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c"
solver-name = "gps-cdcl"
solver-version = 1

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

@ -1,4 +0,0 @@
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "1.0.0"

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

@ -1,12 +0,0 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
_ "github.com/sdboyer/deptest"
)
func main() {
}

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

@ -1,6 +0,0 @@
{
"commands": [
["ensure", "-no-vendor", "-dry-run"]
],
"error-expected": "Gopkg.lock was not up to date"
}

4
cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,14 +2,16 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c"
input-imports = ["github.com/sdboyer/deptest"]
solver-name = "gps-cdcl"
solver-version = 1

4
cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,14 +2,16 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "e7725ea56516a42a641aaaf5d48754258d9f3c59949cb8a0e8a21b1ab6e07179"
input-imports = ["github.com/sdboyer/deptest"]
solver-name = "gps-cdcl"
solver-version = 1

4
cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -3,13 +3,15 @@
[[projects]]
branch = "master"
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "e5c16e09ed6f0a1a2b3cf472c34b7fd50861dd070e81d5e623f72e8173f0c065"
input-imports = ["github.com/sdboyer/deptest"]
solver-name = "gps-cdcl"
solver-version = 1

2
cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -4,6 +4,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7"
input-imports = []
solver-name = "gps-cdcl"
solver-version = 1

4
cmd/dep/testdata/harness_tests/ensure/pkg-ignored/wildcard-ignore/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -3,13 +3,15 @@
[[projects]]
branch = "master"
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "5210e61a67f6e64dabb1eb8f28df2dbeeedfca1588c102067a6ec8a35e0b15f9"
input-imports = ["github.com/sdboyer/deptest"]
solver-name = "gps-cdcl"
solver-version = 1

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

@ -1,11 +0,0 @@
-CONSTRAINTS-
github.com/sdboyer/deptest
b-master
-IMPORTS/REQS-
github.com/sdboyer/deptest
-IGNORES-
-OVERRIDES-
-ANALYZER-
dep
1

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

@ -1,7 +1,6 @@
{
"commands": [
["ensure"],
["hash-inputs"]
["ensure"]
],
"error-expected": "",
"vendor-final": [

2
cmd/dep/testdata/harness_tests/ensure/pkg-ignored/wildcard-other-root/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -4,6 +4,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "b02b7a80e20404724ba5dbffab28e772017b03800916327f58bff0da86071b6a"
input-imports = []
solver-name = "gps-cdcl"
solver-version = 1

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

@ -1,9 +0,0 @@
-CONSTRAINTS-
-IMPORTS/REQS-
-IGNORES-
github.com/sdboyer/deptest*
-OVERRIDES-
-ANALYZER-
dep
1

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

@ -1,7 +1,6 @@
{
"commands": [
["ensure"],
["hash-inputs"]
["ensure"]
],
"error-expected": "",
"vendor-final": []

9
cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,27 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = ""
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/ensure/update/desync/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,27 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = ""
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
solver-name = "gps-cdcl"
solver-version = 1

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

@ -1 +0,0 @@
Warning: Gopkg.lock is out of sync with Gopkg.toml or the project's imports.

4
cmd/dep/testdata/harness_tests/ensure/update/novendor/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,14 +2,16 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c"
input-imports = ["github.com/sdboyer/deptest"]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,19 +2,26 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v0.8.0"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = "UT"
revision = "a0196baa11ea047dd65037287451d36b861b00ea"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,27 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v0.8.0"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = "UT"
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "ced51326ad990b11098d8076d0f7d72d89eee1ba6e8dacc7bc73be05cddac438"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -3,18 +3,25 @@
[[projects]]
branch = "master"
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = "UT"
revision = "a0196baa11ea047dd65037287451d36b861b00ea"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "af9a783a5430dabcaaf44683c09e2b729e1c0d61f13bfdf6677c4fd0b41387ca"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/init/case4/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,27 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = "UT"
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "a6ba2237d28d125b55fc6c86e94e33363f1dfd880d471118d36d7587398c30b4"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
solver-name = "gps-cdcl"
solver-version = 1

11
cmd/dep/testdata/harness_tests/init/glide/case1/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,25 +2,34 @@
[[projects]]
digest = "1:4f2c2c251356e56fdbe13960044263cdbde63355689e21db07267c4d0de33f3f"
name = "github.com/carolynvs/deptest-subpkg"
packages = ["subby"]
pruneopts = "UT"
revision = "6c41d90f78bb1015696a2ad591debfa8971512d5"
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = "UT"
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "def34af0f7cd619e1601eb68bdabf399c9b36a79c2081306adefa0ced03d182b"
input-imports = [
"github.com/carolynvs/deptest-subpkg/subby",
"github.com/sdboyer/deptestdos"
]
solver-name = "gps-cdcl"
solver-version = 1

6
cmd/dep/testdata/harness_tests/init/glide/case2/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,24 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = "UT"
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1ed417a0bec57ffe988fae1cba8f3d49994fb893394d61844e0b3c96d69573fe"
input-imports = ["github.com/sdboyer/deptestdos"]
solver-name = "gps-cdcl"
solver-version = 1

6
cmd/dep/testdata/harness_tests/init/glide/case3/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,24 @@
[[projects]]
digest = "1:41a463620bcc5eba54d225d6108f58da4be08bc6307ecc9d17c6d1a5c1f2df30"
name = "github.com/carolynvs/deptestglide"
packages = ["."]
pruneopts = "UT"
revision = "aa7fea6e17ca281c6f210afb93fc3c98ef29a695"
version = "v0.1.1"
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "87996f836c70eac9c14221085412cbc96eb98cc6a0782c0724575a56511abe8d"
input-imports = ["github.com/carolynvs/deptestglide"]
solver-name = "gps-cdcl"
solver-version = 1

6
cmd/dep/testdata/harness_tests/init/glide/case4/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,24 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = "UT"
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1ed417a0bec57ffe988fae1cba8f3d49994fb893394d61844e0b3c96d69573fe"
input-imports = ["github.com/sdboyer/deptestdos"]
solver-name = "gps-cdcl"
solver-version = 1

8
cmd/dep/testdata/harness_tests/init/glide/corrupt-glide/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,26 +2,32 @@
[[projects]]
digest = "1:c0ee004f748a2e0a166f94d0aae3e4b34d0cb1aa95672075969feded052cde73"
name = "github.com/ChinmayR/deptestglideA"
packages = ["."]
pruneopts = "UT"
revision = "cead75b1cde64ae1353ddbf73f6089303d6001b4"
version = "v0.3.0"
[[projects]]
digest = "1:855fce2344c810402e7e6d34a1e7e21f6b5e161689d0c3c086f920a212e3b074"
name = "github.com/ChinmayR/deptestglideB"
packages = ["."]
pruneopts = "UT"
revision = "571b81795d767461736e6d0ca69e5f9840bdbf0e"
version = "v0.5.0"
[[projects]]
digest = "1:2cb412b34b26e26b270605d2c54e94a01b5f018ca060a87543bb3b72e21dca07"
name = "github.com/ChinmayR/deptestglideC"
packages = ["."]
pruneopts = "UT"
revision = "4d3546304e8a1ceb6bb01e7e6201e852abb8ae4d"
version = "v0.1.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "86bfffc8c6e5de1a4f6c613dcd88d5b76d8b5b17bf797320eb6842bf9239837d"
input-imports = ["github.com/ChinmayR/deptestglideA"]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/init/glide/direct-trans-no-conflict/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,27 @@
[[projects]]
digest = "1:2bb2f3f169ad31382b7b41969518a99fe8974f4f5a737b6c30501a36f2fd40dc"
name = "github.com/ChinmayR/deptestglideA"
packages = ["."]
pruneopts = "UT"
revision = "26ab0f16d85723be5ff44e5b4bd2a8e0f3a34989"
version = "v0.2.0"
[[projects]]
digest = "1:d35fc62a5ecad295b86623f47a2b3d6ce4e81cd9584c04b41d05c9cafea9137e"
name = "github.com/ChinmayR/deptestglideB"
packages = ["."]
pruneopts = "UT"
revision = "143bb0e8f4cc3a3227a2d250f99d08ee879c7909"
version = "v0.2.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "9f6691009992b85820af581ac5f81b1537fd791351a83ec852c7a553939dbae5"
input-imports = [
"github.com/ChinmayR/deptestglideA",
"github.com/ChinmayR/deptestglideB"
]
solver-name = "gps-cdcl"
solver-version = 1

11
cmd/dep/testdata/harness_tests/init/glide/trans-trans-unspecified/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,26 +2,35 @@
[[projects]]
digest = "1:f3ebbb24c30241998a9b891d83113b4edd70b7d710fac33a4a20cb7b135f2677"
name = "github.com/ChinmayR/deptestglideA"
packages = ["."]
pruneopts = "UT"
revision = "703f28fdee407d70dcc4cb774a0fbb82fa70daa9"
version = "v0.4.0"
[[projects]]
digest = "1:1c78f2479f39bf0b209d0ec082acfb2816ad3c79813ac49a57ce8997a6039b29"
name = "github.com/ChinmayR/deptestglideB"
packages = ["."]
pruneopts = "UT"
revision = "55b6737d9d84461196123a51baa02b156abc4543"
version = "v0.4.0"
[[projects]]
digest = "1:2cb412b34b26e26b270605d2c54e94a01b5f018ca060a87543bb3b72e21dca07"
name = "github.com/ChinmayR/deptestglideC"
packages = ["."]
pruneopts = "UT"
revision = "4d3546304e8a1ceb6bb01e7e6201e852abb8ae4d"
version = "v0.1.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "178a09819c33edcef8eb9c4ed26cc9053aed45e4f04645085feaef7921c8688c"
input-imports = [
"github.com/ChinmayR/deptestglideA",
"github.com/ChinmayR/deptestglideB"
]
solver-name = "gps-cdcl"
solver-version = 1

11
cmd/dep/testdata/harness_tests/init/glide/trans-trans/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,26 +2,35 @@
[[projects]]
digest = "1:698cd4951cb265ae57d473cc883630bd2d5cc9a472fe513acd54886751cb0457"
name = "github.com/ChinmayR/deptestglideA"
packages = ["."]
pruneopts = "UT"
revision = "2f77d68963bb3dff94b88330d930cb59714cd2fc"
version = "v0.5.0"
[[projects]]
digest = "1:0ed6d2f0ec01022dbca6d19f6a89a4200a9430c51f07309446c3751591fc3c39"
name = "github.com/ChinmayR/deptestglideB"
packages = ["."]
pruneopts = "UT"
revision = "7f8abdec9e29a008d40cfcbb0848b82cc4000d25"
version = "v0.3.0"
[[projects]]
digest = "1:4f14135d41f9b3692c6ac4e9defe4ea020ddeb41a169ba26fd1abdd193e097cd"
name = "github.com/ChinmayR/deptestglideC"
packages = ["."]
pruneopts = "UT"
revision = "73ba3c1897d21e64bec0b89a026a1acb6604e846"
version = "v0.2.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "e4ba06c77ad87955efd40ad92c8ddc0cd6dba1137fecdc958f02cc79b1f64202"
input-imports = [
"github.com/ChinmayR/deptestglideA",
"github.com/ChinmayR/deptestglideB"
]
solver-name = "gps-cdcl"
solver-version = 1

6
cmd/dep/testdata/harness_tests/init/glock/case1/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,24 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = "UT"
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1ed417a0bec57ffe988fae1cba8f3d49994fb893394d61844e0b3c96d69573fe"
input-imports = ["github.com/sdboyer/deptestdos"]
solver-name = "gps-cdcl"
solver-version = 1

6
cmd/dep/testdata/harness_tests/init/godep/case1/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,24 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = "UT"
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1ed417a0bec57ffe988fae1cba8f3d49994fb893394d61844e0b3c96d69573fe"
input-imports = ["github.com/sdboyer/deptestdos"]
solver-name = "gps-cdcl"
solver-version = 1

6
cmd/dep/testdata/harness_tests/init/govend/case1/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,24 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = "UT"
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1ed417a0bec57ffe988fae1cba8f3d49994fb893394d61844e0b3c96d69573fe"
input-imports = ["github.com/sdboyer/deptestdos"]
solver-name = "gps-cdcl"
solver-version = 1

6
cmd/dep/testdata/harness_tests/init/govendor/case1/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,24 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = "UT"
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "9cc662f2e1b80c8df205d9d667fe2c47825a06961ceae378f44a8290d01dd359"
input-imports = ["github.com/sdboyer/deptestdos"]
solver-name = "gps-cdcl"
solver-version = 1

12
cmd/dep/testdata/harness_tests/init/gvt/case1/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,27 +2,37 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
source = "https://github.com/carolynvs/deptest"
version = "v0.8.1"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = "UT"
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[[projects]]
branch = "v2"
digest = "1:10978cfda94a2069ac38ed0884b606aafe89f4578ff700b7845b02201a2d6b51"
name = "gopkg.in/yaml.v2"
packages = ["."]
pruneopts = "UT"
revision = "f7716cbe52baa25d2e9b0d0da546fcf909fc16b4"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "d1681978cbca0e845950451461e0d69b58c5e896d9fd10ec5c159a4db3175161"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos",
"gopkg.in/yaml.v2"
]
solver-name = "gps-cdcl"
solver-version = 1

4
cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,14 +2,16 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c"
input-imports = ["github.com/sdboyer/deptest"]
solver-name = "gps-cdcl"
solver-version = 1

6
cmd/dep/testdata/harness_tests/init/vndr/case1/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,24 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = "UT"
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = "UT"
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1ed417a0bec57ffe988fae1cba8f3d49994fb893394d61844e0b3c96d69573fe"
input-imports = ["github.com/sdboyer/deptestdos"]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/status/case1/dot/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,27 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v0.8.0"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = ""
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/status/case1/json/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,27 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v0.8.0"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = ""
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/status/case1/table/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,27 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v0.8.0"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = ""
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/status/case1/template/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,27 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v0.8.0"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = ""
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb"
input-imports = [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
solver-name = "gps-cdcl"
solver-version = 1

9
cmd/dep/testdata/harness_tests/status/ignore_lock_mismatch/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -1,9 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7"
solver-name = "gps-cdcl"
solver-version = 1

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

@ -1,2 +0,0 @@
ignored = ["github.com/sdboyer/deptestdos"]

9
cmd/dep/testdata/harness_tests/status/ignore_lock_mismatch/initial/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -1,9 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7"
solver-name = "gps-cdcl"
solver-version = 1

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

@ -1,2 +0,0 @@
ignored = ["github.com/sdboyer/deptestdos"]

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

@ -1,12 +0,0 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
_ "github.com/sdboyer/deptestdos"
)
func main() {
}

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

@ -1,7 +0,0 @@
{
"commands": [
["status"]
],
"error-expected": "This happens when Gopkg.toml is modified",
"vendor-final": []
}

12
cmd/dep/testdata/harness_tests/status/old_constraints/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,26 +2,36 @@
[[projects]]
digest = "1:9f15720b74cca39adad1ea61f19e1aee73ed1a83cc3922521101fc758fa75715"
name = "github.com/carolynvs/go-dep-test"
packages = ["."]
pruneopts = ""
revision = "b9c5511fa463628e6251554db29a4be161d02aed"
version = "0.1.0"
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = ""
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "c89811fc98c9a1310c94dc63b84f364d13c46ea3a40bd2cba7d77377ab346543"
input-imports = [
"github.com/carolynvs/go-dep-test",
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
solver-name = "gps-cdcl"
solver-version = 1

6
cmd/dep/testdata/harness_tests/status/override_constraint/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,20 +2,24 @@
[[projects]]
digest = "1:6a4b7ea94689d9d4f231605ecc0248fbcbf16419d8571adb59c00396e37bbfc2"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
version = "v0.8.1"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = ""
revision = "5c607206be5decd28e6263ffffdcee067266015e"
version = "v2.0.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "1c4444f47ab5d5c484634d1a0c95d99beb879a37337bc0d7aecbd97cf79b6cb1"
input-imports = ["github.com/sdboyer/deptestdos"]
solver-name = "gps-cdcl"
solver-version = 1

6
cmd/dep/testdata/harness_tests/status/revision_constraint/final/Gopkg.lock сгенерированный поставляемый
Просмотреть файл

@ -2,19 +2,23 @@
[[projects]]
digest = "1:ddbbbe7f7a81c86d54e89fa388b532f4c144d666a14e8e483ba04fa58265b135"
name = "github.com/sdboyer/deptest"
packages = ["."]
pruneopts = ""
revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf"
version = "v1.0.0"
[[projects]]
digest = "1:d71dc37a7f6ffbbe0c768f28d904acade8f068cbd96c6e6f0885425d3c3b8df9"
name = "github.com/sdboyer/deptestdos"
packages = ["."]
pruneopts = ""
revision = "a0196baa11ea047dd65037287451d36b861b00ea"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "a64abd431f23d6fbc8d83aef311d33ab12b3a6c74a46c271e89c2542c98bbb9a"
input-imports = ["github.com/sdboyer/deptestdos"]
solver-name = "gps-cdcl"
solver-version = 1

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

@ -175,40 +175,39 @@ func (c *Ctx) LoadProject() (*Project, error) {
return nil, errors.Wrapf(err, "error while parsing %s", mp)
}
lp := filepath.Join(p.AbsRoot, LockName)
lf, err := os.Open(lp)
if err != nil {
if os.IsNotExist(err) {
// It's fine for the lock not to exist
return p, nil
}
// But if a lock does exist and we can't open it, that's a problem
return nil, errors.Wrapf(err, "could not open %s", lp)
}
defer lf.Close()
p.Lock, err = readLock(lf)
if err != nil {
return nil, errors.Wrapf(err, "error while parsing %s", lp)
}
// Parse in the root package tree.
ptree, err := p.parseRootPackageTree()
if err != nil {
return nil, err
}
// If there's a current Lock, apply the input and pruneopt changes that we
// can know without solving.
if p.Lock != nil {
p.ChangedLock = p.Lock.dup()
p.ChangedLock.SolveMeta.InputImports = externalImportList(ptree, p.Manifest)
lp := filepath.Join(p.AbsRoot, LockName)
lf, err := os.Open(lp)
if err == nil {
defer lf.Close()
for k, lp := range p.ChangedLock.Projects() {
vp := lp.(verify.VerifiableProject)
vp.PruneOpts = p.Manifest.PruneOptions.PruneOptionsFor(lp.Ident().ProjectRoot)
p.ChangedLock.P[k] = vp
p.Lock, err = readLock(lf)
if err != nil {
return nil, errors.Wrapf(err, "error while parsing %s", lp)
}
// If there's a current Lock, apply the input and pruneopt changes that we
// can know without solving.
if p.Lock != nil {
p.ChangedLock = p.Lock.dup()
p.ChangedLock.SolveMeta.InputImports = externalImportList(ptree, p.Manifest)
for k, lp := range p.ChangedLock.Projects() {
vp := lp.(verify.VerifiableProject)
vp.PruneOpts = p.Manifest.PruneOptions.PruneOptionsFor(lp.Ident().ProjectRoot)
p.ChangedLock.P[k] = vp
}
}
} else if !os.IsNotExist(err) {
// It's fine for the lock not to exist, but if a file does exist and we
// can't open it, that's a problem.
return nil, errors.Wrapf(err, "could not open %s", lp)
}
return p, nil

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

@ -6,43 +6,12 @@ package verify
import (
"bytes"
"fmt"
"sort"
"strings"
"github.com/golang/dep/gps"
)
// StringDiff represents a modified string value.
// * Added: Previous = nil, Current != nil
// * Deleted: Previous != nil, Current = nil
// * Modified: Previous != nil, Current != nil
// * No Change: Previous = Current, or a nil pointer
type StringDiff struct {
Previous string
Current string
}
func (diff *StringDiff) String() string {
if diff == nil {
return ""
}
if diff.Previous == "" && diff.Current != "" {
return fmt.Sprintf("+ %s", diff.Current)
}
if diff.Previous != "" && diff.Current == "" {
return fmt.Sprintf("- %s", diff.Previous)
}
if diff.Previous != diff.Current {
return fmt.Sprintf("%s -> %s", diff.Previous, diff.Current)
}
return diff.Current
}
// sortLockedProjects returns a sorted copy of lps, or itself if already sorted.
func sortLockedProjects(lps []gps.LockedProject) []gps.LockedProject {
if len(lps) <= 1 || sort.SliceIsSorted(lps, func(i, j int) bool {
@ -60,31 +29,12 @@ func sortLockedProjects(lps []gps.LockedProject) []gps.LockedProject {
return cp
}
// LockDiff is the set of differences between an existing lock file and an updated lock file.
// Fields are only populated when there is a difference, otherwise they are empty.
type LockDiff struct {
Add []LockedProjectDiff
Remove []LockedProjectDiff
Modify []LockedProjectDiff
}
type LockDelta struct {
AddedImportInputs []string
RemovedImportInputs []string
ProjectDeltas map[gps.ProjectRoot]LockedProjectDelta
}
// LockedProjectDiff contains the before and after snapshot of a project reference.
// Fields are only populated when there is a difference, otherwise they are empty.
type LockedProjectDiff struct {
Name gps.ProjectRoot
Source *StringDiff
Version *StringDiff
Branch *StringDiff
Revision *StringDiff
Packages []StringDiff
}
type LockedProjectDelta struct {
Name gps.ProjectRoot
ProjectRemoved, ProjectAdded bool
@ -258,7 +208,9 @@ func DiffProjects2(lp1, lp2 gps.LockedProject) LockedProjectPartsDelta {
return ld
}
type DeltaDimension uint16
// DeltaDimension defines a bitset enumerating all of the different dimensions
// along which a Lock, and its constitutent components, can change.
type DeltaDimension uint32
const (
InputImportsChanged DeltaDimension = 1 << iota
@ -274,13 +226,17 @@ const (
AnyChanged = (1 << iota) - 1
)
func (ld LockDelta) Changed(flags DeltaDimension) bool {
if flags&InputImportsChanged != 0 && (len(ld.AddedImportInputs) > 0 || len(ld.RemovedImportInputs) > 0) {
// Changed indicates whether the delta contains a change along the dimensions
// with their corresponding bits set.
//
// This implementation checks the topmost-level Lock properties
func (ld LockDelta) Changed(dims DeltaDimension) bool {
if dims&InputImportsChanged != 0 && (len(ld.AddedImportInputs) > 0 || len(ld.RemovedImportInputs) > 0) {
return true
}
for _, ld := range ld.ProjectDeltas {
if ld.Changed(AnyChanged) {
if ld.Changed(dims & ^InputImportsChanged) {
return true
}
}
@ -288,6 +244,19 @@ func (ld LockDelta) Changed(flags DeltaDimension) bool {
return false
}
func (ld LockDelta) Changes(DeltaDimension) DeltaDimension {
var dd DeltaDimension
if len(ld.AddedImportInputs) > 0 || len(ld.RemovedImportInputs) > 0 {
dd |= InputImportsChanged
}
for _, ld := range ld.ProjectDeltas {
dd |= ld.Changes()
}
return dd
}
// Changed indicates whether the delta contains a change along the dimensions
// with their corresponding bits set.
//
@ -306,6 +275,19 @@ func (ld LockedProjectDelta) Changed(flags DeltaDimension) bool {
return ld.LockedProjectPartsDelta.Changed(flags & ^ProjectAdded & ^ProjectRemoved)
}
func (ld LockedProjectDelta) Changes() DeltaDimension {
var dd DeltaDimension
if ld.WasAdded() {
dd |= ProjectAdded
}
if ld.WasRemoved() {
dd |= ProjectRemoved
}
return dd | ld.LockedProjectPartsDelta.Changes()
}
func (ld LockedProjectDelta) WasRemoved() bool {
return ld.ProjectRemoved
}
@ -318,27 +300,21 @@ func (ld LockedProjectPartsDelta) Changed(flags DeltaDimension) bool {
if flags&SourceChanged != 0 && ld.SourceChanged() {
return true
}
if flags&RevisionChanged != 0 && ld.RevisionChanged() {
return true
}
if flags&PruneOptsChanged != 0 && ld.PruneOptsChanged() {
return true
}
if flags&HashChanged != 0 && ld.HashChanged {
return true
}
if flags&HashVersionChanged != 0 && ld.HashVersionChanged {
return true
}
if flags&VersionChanged != 0 && ld.VersionChanged() {
return true
}
if flags&PackagesChanged != 0 && ld.PackagesChanged() {
return true
}
@ -346,6 +322,33 @@ func (ld LockedProjectPartsDelta) Changed(flags DeltaDimension) bool {
return false
}
func (ld LockedProjectPartsDelta) Changes() DeltaDimension {
var dd DeltaDimension
if ld.SourceChanged() {
dd |= SourceChanged
}
if ld.RevisionChanged() {
dd |= RevisionChanged
}
if ld.PruneOptsChanged() {
dd |= PruneOptsChanged
}
if ld.HashChanged {
dd |= HashChanged
}
if ld.HashVersionChanged {
dd |= HashVersionChanged
}
if ld.VersionChanged() {
dd |= VersionChanged
}
if ld.PackagesChanged() {
dd |= PackagesChanged
}
return dd
}
func (ld LockedProjectPartsDelta) SourceChanged() bool {
return ld.SourceBefore != ld.SourceAfter
}
@ -384,209 +387,7 @@ func (ld LockedProjectPartsDelta) PruneOptsChanged() bool {
return ld.PruneOptsBefore != ld.PruneOptsAfter
}
// DiffLocks compares two locks and identifies the differences between them.
// Returns nil if there are no differences.
func DiffLocks(l1, l2 gps.Lock) *LockDiff {
// Default nil locks to empty locks, so that we can still generate a diff
if l1 == nil {
l1 = gps.SimpleLock{}
}
if l2 == nil {
l2 = gps.SimpleLock{}
}
p1, p2 := l1.Projects(), l2.Projects()
p1 = sortLockedProjects(p1)
p2 = sortLockedProjects(p2)
diff := LockDiff{}
var i2next int
for i1 := 0; i1 < len(p1); i1++ {
lp1 := p1[i1]
pr1 := lp1.Ident().ProjectRoot
var matched bool
for i2 := i2next; i2 < len(p2); i2++ {
lp2 := p2[i2]
pr2 := lp2.Ident().ProjectRoot
switch strings.Compare(string(pr1), string(pr2)) {
case 0: // Found a matching project
matched = true
pdiff := DiffProjects(lp1, lp2)
if pdiff != nil {
diff.Modify = append(diff.Modify, *pdiff)
}
i2next = i2 + 1 // Don't evaluate to this again
case +1: // Found a new project
add := buildLockedProjectDiff(lp2)
diff.Add = append(diff.Add, add)
i2next = i2 + 1 // Don't evaluate to this again
continue // Keep looking for a matching project
case -1: // Project has been removed, handled below
continue
}
break // Done evaluating this project, move onto the next
}
if !matched {
remove := buildLockedProjectDiff(lp1)
diff.Remove = append(diff.Remove, remove)
}
}
// Anything that still hasn't been evaluated are adds
for i2 := i2next; i2 < len(p2); i2++ {
lp2 := p2[i2]
add := buildLockedProjectDiff(lp2)
diff.Add = append(diff.Add, add)
}
if len(diff.Add) == 0 && len(diff.Remove) == 0 && len(diff.Modify) == 0 {
return nil // The locks are the equivalent
}
return &diff
}
// DiffFor checks to see if there was a diff for the provided ProjectRoot. The
// first return value is a 0 if there was no diff, 1 if it was added, 2 if it
// was removed, and 3 if it was modified.
func (ld *LockDiff) DiffFor(pr gps.ProjectRoot) (uint8, LockedProjectDiff) {
for _, lpd := range ld.Add {
if lpd.Name == pr {
return 1, lpd
}
}
for _, lpd := range ld.Remove {
if lpd.Name == pr {
return 2, lpd
}
}
for _, lpd := range ld.Modify {
if lpd.Name == pr {
return 3, lpd
}
}
return 0, LockedProjectDiff{}
}
func buildLockedProjectDiff(lp gps.LockedProject) LockedProjectDiff {
s2 := lp.Ident().Source
r2, b2, v2 := gps.VersionComponentStrings(lp.Version())
var rev, version, branch, source *StringDiff
if s2 != "" {
source = &StringDiff{Previous: s2, Current: s2}
}
if r2 != "" {
rev = &StringDiff{Previous: r2, Current: r2}
}
if b2 != "" {
branch = &StringDiff{Previous: b2, Current: b2}
}
if v2 != "" {
version = &StringDiff{Previous: v2, Current: v2}
}
add := LockedProjectDiff{
Name: lp.Ident().ProjectRoot,
Source: source,
Revision: rev,
Version: version,
Branch: branch,
Packages: make([]StringDiff, len(lp.Packages())),
}
for i, pkg := range lp.Packages() {
add.Packages[i] = StringDiff{Previous: pkg, Current: pkg}
}
return add
}
// DiffProjects compares two projects and identifies the differences between them.
// Returns nil if there are no differences.
func DiffProjects(lp1, lp2 gps.LockedProject) *LockedProjectDiff {
diff := LockedProjectDiff{Name: lp1.Ident().ProjectRoot}
s1 := lp1.Ident().Source
s2 := lp2.Ident().Source
if s1 != s2 {
diff.Source = &StringDiff{Previous: s1, Current: s2}
}
r1, b1, v1 := gps.VersionComponentStrings(lp1.Version())
r2, b2, v2 := gps.VersionComponentStrings(lp2.Version())
if r1 != r2 {
diff.Revision = &StringDiff{Previous: r1, Current: r2}
}
if b1 != b2 {
diff.Branch = &StringDiff{Previous: b1, Current: b2}
}
if v1 != v2 {
diff.Version = &StringDiff{Previous: v1, Current: v2}
}
p1 := lp1.Packages()
p2 := lp2.Packages()
if !sort.StringsAreSorted(p1) {
p1 = make([]string, len(p1))
copy(p1, lp1.Packages())
sort.Strings(p1)
}
if !sort.StringsAreSorted(p2) {
p2 = make([]string, len(p2))
copy(p2, lp2.Packages())
sort.Strings(p2)
}
var i2next int
for i1 := 0; i1 < len(p1); i1++ {
pkg1 := p1[i1]
var matched bool
for i2 := i2next; i2 < len(p2); i2++ {
pkg2 := p2[i2]
switch strings.Compare(pkg1, pkg2) {
case 0: // Found matching package
matched = true
i2next = i2 + 1 // Don't evaluate to this again
case +1: // Found a new package
add := StringDiff{Current: pkg2}
diff.Packages = append(diff.Packages, add)
i2next = i2 + 1 // Don't evaluate to this again
continue // Keep looking for a match
case -1: // Package has been removed (handled below)
continue
}
break // Done evaluating this package, move onto the next
}
if !matched {
diff.Packages = append(diff.Packages, StringDiff{Previous: pkg1})
}
}
// Anything that still hasn't been evaluated are adds
for i2 := i2next; i2 < len(p2); i2++ {
pkg2 := p2[i2]
add := StringDiff{Current: pkg2}
diff.Packages = append(diff.Packages, add)
}
if diff.Source == nil && diff.Version == nil && diff.Revision == nil && len(diff.Packages) == 0 {
return nil // The projects are equivalent
}
return &diff
}
type VendorDiff struct {
LockDelta LockDelta
VendorStatus map[string]VendorStatus
}
//type VendorDiff struct {
//LockDelta LockDelta
//VendorStatus map[string]VendorStatus
//}

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

@ -10,7 +10,6 @@ import (
"log"
"github.com/golang/dep/gps"
"github.com/golang/dep/gps/verify"
)
const (
@ -88,7 +87,7 @@ type brokenImport interface {
}
type modifiedImport struct {
source, branch, revision, version *verify.StringDiff
source, branch, revision, version *StringDiff
projectPath string
}
@ -124,7 +123,7 @@ func (mi modifiedImport) String() string {
}
type removedImport struct {
source, branch, revision, version *verify.StringDiff
source, branch, revision, version *StringDiff
projectPath string
}
@ -158,10 +157,13 @@ type BrokenImportFeedback struct {
// NewBrokenImportFeedback builds a feedback entry that compares an initially
// imported, unsolved lock to the same lock after it has been solved.
func NewBrokenImportFeedback(ld *verify.LockDiff) *BrokenImportFeedback {
func NewBrokenImportFeedback(ld *LockDiff) *BrokenImportFeedback {
bi := &BrokenImportFeedback{}
if ld == nil {
return bi
}
for _, lpd := range ld.Modify {
// Ignore diffs where it's just a modified package set
if lpd.Branch == nil && lpd.Revision == nil && lpd.Source == nil && lpd.Version == nil {
continue
}

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

@ -10,9 +10,7 @@ import (
"strings"
"testing"
"github.com/golang/dep"
"github.com/golang/dep/gps"
"github.com/golang/dep/gps/verify"
_ "github.com/golang/dep/internal/test" // DO NOT REMOVE, allows go test ./... -update to work
)
@ -144,14 +142,14 @@ func TestFeedback_BrokenImport(t *testing.T) {
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
buf := &bytes.Buffer{}
ol := dep.Lock{
P: []gps.LockedProject{gps.NewLockedProject(c.pID, c.oldVersion, nil)},
ol := gps.SimpleLock{
gps.NewLockedProject(c.pID, c.oldVersion, nil),
}
l := dep.Lock{
P: []gps.LockedProject{gps.NewLockedProject(c.altPID, c.currentVersion, nil)},
l := gps.SimpleLock{
gps.NewLockedProject(c.altPID, c.currentVersion, nil),
}
log := log2.New(buf, "", 0)
feedback := NewBrokenImportFeedback(verify.DiffLocks(&ol, &l))
feedback := NewBrokenImportFeedback(DiffLocks(&ol, &l))
feedback.LogFeedback(log)
got := strings.TrimSpace(buf.String())
if c.want != got {

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

@ -0,0 +1,252 @@
package feedback
import (
"fmt"
"sort"
"strings"
"github.com/golang/dep/gps"
)
// StringDiff represents a modified string value.
// * Added: Previous = nil, Current != nil
// * Deleted: Previous != nil, Current = nil
// * Modified: Previous != nil, Current != nil
// * No Change: Previous = Current, or a nil pointer
type StringDiff struct {
Previous string
Current string
}
func (diff *StringDiff) String() string {
if diff == nil {
return ""
}
if diff.Previous == "" && diff.Current != "" {
return fmt.Sprintf("+ %s", diff.Current)
}
if diff.Previous != "" && diff.Current == "" {
return fmt.Sprintf("- %s", diff.Previous)
}
if diff.Previous != diff.Current {
return fmt.Sprintf("%s -> %s", diff.Previous, diff.Current)
}
return diff.Current
}
// LockDiff is the set of differences between an existing lock file and an updated lock file.
// Fields are only populated when there is a difference, otherwise they are empty.
type LockDiff struct {
Add []LockedProjectDiff
Remove []LockedProjectDiff
Modify []LockedProjectDiff
}
// LockedProjectDiff contains the before and after snapshot of a project reference.
// Fields are only populated when there is a difference, otherwise they are empty.
type LockedProjectDiff struct {
Name gps.ProjectRoot
Source *StringDiff
Version *StringDiff
Branch *StringDiff
Revision *StringDiff
Packages []StringDiff
}
// DiffLocks compares two locks and identifies the differences between them.
// Returns nil if there are no differences.
func DiffLocks(l1, l2 gps.Lock) *LockDiff {
// Default nil locks to empty locks, so that we can still generate a diff
if l1 == nil {
l1 = gps.SimpleLock{}
}
if l2 == nil {
l2 = gps.SimpleLock{}
}
p1, p2 := l1.Projects(), l2.Projects()
p1 = sortLockedProjects(p1)
p2 = sortLockedProjects(p2)
diff := LockDiff{}
var i2next int
for i1 := 0; i1 < len(p1); i1++ {
lp1 := p1[i1]
pr1 := lp1.Ident().ProjectRoot
var matched bool
for i2 := i2next; i2 < len(p2); i2++ {
lp2 := p2[i2]
pr2 := lp2.Ident().ProjectRoot
switch strings.Compare(string(pr1), string(pr2)) {
case 0: // Found a matching project
matched = true
pdiff := DiffProjects(lp1, lp2)
if pdiff != nil {
diff.Modify = append(diff.Modify, *pdiff)
}
i2next = i2 + 1 // Don't evaluate to this again
case +1: // Found a new project
add := buildLockedProjectDiff(lp2)
diff.Add = append(diff.Add, add)
i2next = i2 + 1 // Don't evaluate to this again
continue // Keep looking for a matching project
case -1: // Project has been removed, handled below
continue
}
break // Done evaluating this project, move onto the next
}
if !matched {
remove := buildLockedProjectDiff(lp1)
diff.Remove = append(diff.Remove, remove)
}
}
// Anything that still hasn't been evaluated are adds
for i2 := i2next; i2 < len(p2); i2++ {
lp2 := p2[i2]
add := buildLockedProjectDiff(lp2)
diff.Add = append(diff.Add, add)
}
if len(diff.Add) == 0 && len(diff.Remove) == 0 && len(diff.Modify) == 0 {
return nil // The locks are the equivalent
}
return &diff
}
func buildLockedProjectDiff(lp gps.LockedProject) LockedProjectDiff {
s2 := lp.Ident().Source
r2, b2, v2 := gps.VersionComponentStrings(lp.Version())
var rev, version, branch, source *StringDiff
if s2 != "" {
source = &StringDiff{Previous: s2, Current: s2}
}
if r2 != "" {
rev = &StringDiff{Previous: r2, Current: r2}
}
if b2 != "" {
branch = &StringDiff{Previous: b2, Current: b2}
}
if v2 != "" {
version = &StringDiff{Previous: v2, Current: v2}
}
add := LockedProjectDiff{
Name: lp.Ident().ProjectRoot,
Source: source,
Revision: rev,
Version: version,
Branch: branch,
Packages: make([]StringDiff, len(lp.Packages())),
}
for i, pkg := range lp.Packages() {
add.Packages[i] = StringDiff{Previous: pkg, Current: pkg}
}
return add
}
// DiffProjects compares two projects and identifies the differences between them.
// Returns nil if there are no differences.
func DiffProjects(lp1, lp2 gps.LockedProject) *LockedProjectDiff {
diff := LockedProjectDiff{Name: lp1.Ident().ProjectRoot}
s1 := lp1.Ident().Source
s2 := lp2.Ident().Source
if s1 != s2 {
diff.Source = &StringDiff{Previous: s1, Current: s2}
}
r1, b1, v1 := gps.VersionComponentStrings(lp1.Version())
r2, b2, v2 := gps.VersionComponentStrings(lp2.Version())
if r1 != r2 {
diff.Revision = &StringDiff{Previous: r1, Current: r2}
}
if b1 != b2 {
diff.Branch = &StringDiff{Previous: b1, Current: b2}
}
if v1 != v2 {
diff.Version = &StringDiff{Previous: v1, Current: v2}
}
p1 := lp1.Packages()
p2 := lp2.Packages()
if !sort.StringsAreSorted(p1) {
p1 = make([]string, len(p1))
copy(p1, lp1.Packages())
sort.Strings(p1)
}
if !sort.StringsAreSorted(p2) {
p2 = make([]string, len(p2))
copy(p2, lp2.Packages())
sort.Strings(p2)
}
var i2next int
for i1 := 0; i1 < len(p1); i1++ {
pkg1 := p1[i1]
var matched bool
for i2 := i2next; i2 < len(p2); i2++ {
pkg2 := p2[i2]
switch strings.Compare(pkg1, pkg2) {
case 0: // Found matching package
matched = true
i2next = i2 + 1 // Don't evaluate to this again
case +1: // Found a new package
add := StringDiff{Current: pkg2}
diff.Packages = append(diff.Packages, add)
i2next = i2 + 1 // Don't evaluate to this again
continue // Keep looking for a match
case -1: // Package has been removed (handled below)
continue
}
break // Done evaluating this package, move onto the next
}
if !matched {
diff.Packages = append(diff.Packages, StringDiff{Previous: pkg1})
}
}
// Anything that still hasn't been evaluated are adds
for i2 := i2next; i2 < len(p2); i2++ {
pkg2 := p2[i2]
add := StringDiff{Current: pkg2}
diff.Packages = append(diff.Packages, add)
}
if diff.Source == nil && diff.Version == nil && diff.Revision == nil && len(diff.Packages) == 0 {
return nil // The projects are equivalent
}
return &diff
}
// sortLockedProjects returns a sorted copy of lps, or itself if already sorted.
func sortLockedProjects(lps []gps.LockedProject) []gps.LockedProject {
if len(lps) <= 1 || sort.SliceIsSorted(lps, func(i, j int) bool {
return lps[i].Ident().Less(lps[j].Ident())
}) {
return lps
}
cp := make([]gps.LockedProject, len(lps))
copy(cp, lps)
sort.Slice(cp, func(i, j int) bool {
return cp[i].Ident().Less(cp[j].Ident())
})
return cp
}

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

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package verify
package feedback
import (
"bytes"

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

@ -131,12 +131,18 @@ func fromRawLock(raw rawLock) (*Lock, error) {
// Projects returns the list of LockedProjects contained in the lock data.
func (l *Lock) Projects() []gps.LockedProject {
if l == nil || l == (*Lock)(nil) {
return nil
}
return l.P
}
// InputImports reports the list of input imports that were used in generating
// this Lock.
func (l *Lock) InputImports() []string {
if l == nil || l == (*Lock)(nil) {
return nil
}
return l.SolveMeta.InputImports
}

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

@ -630,7 +630,7 @@ func (m *Manifest) HasConstraintsOn(root gps.ProjectRoot) bool {
// RequiredPackages returns a set of import paths to require.
func (m *Manifest) RequiredPackages() map[string]bool {
if m == nil {
if m == nil || m == (*Manifest)(nil) {
return map[string]bool{}
}

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

@ -173,7 +173,7 @@ func (p *Project) parseRootPackageTree() (pkgtree.PackageTree, error) {
// GetDirectDependencyNames returns the set of unique Project Roots that are the
// direct dependencies of this Project.
//
// A project is considered a direct dependency if at least one of packages in it
// A project is considered a direct dependency if at least one of its packages
// is named in either this Project's required list, or if there is at least one
// non-ignored import statement from a non-ignored package in the current
// project's package tree.

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

@ -148,6 +148,7 @@ func TestProjectMakeParams(t *testing.T) {
Manifest: m,
Lock: &Lock{},
}
p.ChangedLock = p.Lock
solveParam := p.MakeParams()

2
testdata/txn_writer/expected_lock.toml поставляемый
Просмотреть файл

@ -2,7 +2,7 @@
[[projects]]
digest = "0:"
digest = "1:c4844614e2b12233bb037afec536831b92a4f58f7b712432b978d34df291e43a"
name = "github.com/sdboyer/dep-test"
packages = ["."]
pruneopts = ""

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

@ -15,6 +15,7 @@ import (
"github.com/golang/dep/gps"
"github.com/golang/dep/gps/verify"
"github.com/golang/dep/internal/feedback"
"github.com/golang/dep/internal/fs"
"github.com/pkg/errors"
)
@ -135,7 +136,7 @@ func (sw *SafeWriter) HasManifest() bool {
}
type rawStringDiff struct {
*verify.StringDiff
*feedback.StringDiff
}
// MarshalTOML serializes the diff as a string.
@ -152,7 +153,7 @@ type rawLockedProjectDiff struct {
Packages []rawStringDiff `toml:"packages,omitempty"`
}
func toRawLockedProjectDiff(diff verify.LockedProjectDiff) rawLockedProjectDiff {
func toRawLockedProjectDiff(diff feedback.LockedProjectDiff) rawLockedProjectDiff {
// this is a shallow copy since we aren't modifying the raw diff
raw := rawLockedProjectDiff{Name: diff.Name}
if diff.Source != nil {
@ -178,7 +179,7 @@ type rawLockedProjectDiffs struct {
Projects []rawLockedProjectDiff `toml:"projects"`
}
func toRawLockedProjectDiffs(diffs []verify.LockedProjectDiff) rawLockedProjectDiffs {
func toRawLockedProjectDiffs(diffs []feedback.LockedProjectDiff) rawLockedProjectDiffs {
raw := rawLockedProjectDiffs{
Projects: make([]rawLockedProjectDiff, len(diffs)),
}