From ff254a8fad4a3efaa0f9ae8ac4e3a655c1bf094a Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Tue, 9 May 2017 14:49:25 -0300 Subject: [PATCH 01/19] rename for constraint --- cmd/dep/ensure.go | 4 ++-- cmd/dep/init.go | 4 ++-- cmd/dep/remove.go | 8 ++++---- cmd/dep/status.go | 2 +- manifest.go | 48 +++++++++++++++++++++++------------------------ manifest_test.go | 6 +++--- 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/cmd/dep/ensure.go b/cmd/dep/ensure.go index 8d6f56f3c0..2892c32129 100644 --- a/cmd/dep/ensure.go +++ b/cmd/dep/ensure.go @@ -204,14 +204,14 @@ func applyEnsureArgs(logger *log.Logger, args []string, overrides stringSlice, p // // TODO(sdboyer): for this case - or just in general - do we want to // add project args to the requires list temporarily for this run? - if _, has := p.Manifest.Dependencies[pc.Ident.ProjectRoot]; !has { + if _, has := p.Manifest.Constraints[pc.Ident.ProjectRoot]; !has { logger.Printf("dep: No constraint or alternate source specified for %q, omitting from manifest\n", pc.Ident.ProjectRoot) } // If it's already in the manifest, no need to log continue } - p.Manifest.Dependencies[pc.Ident.ProjectRoot] = gps.ProjectProperties{ + p.Manifest.Constraints[pc.Ident.ProjectRoot] = gps.ProjectProperties{ Source: pc.Ident.Source, Constraint: pc.Constraint, } diff --git a/cmd/dep/init.go b/cmd/dep/init.go index f6e39a9ba4..2600af4c87 100644 --- a/cmd/dep/init.go +++ b/cmd/dep/init.go @@ -116,7 +116,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, loggers *Loggers, args []string) error return err } m := &dep.Manifest{ - Dependencies: pd.constraints, + Constraints: pd.constraints, } // Make an initial lock from what knowledge we've collected about the @@ -175,7 +175,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, loggers *Loggers, args []string) error for k, _ := range pd.notondisk { for _, x := range l.Projects() { if k == x.Ident().ProjectRoot { - m.Dependencies[k] = getProjectPropertiesFromVersion(x.Version()) + m.Constraints[k] = getProjectPropertiesFromVersion(x.Version()) break } } diff --git a/cmd/dep/remove.go b/cmd/dep/remove.go index eff30b0aef..c80dcaf4b6 100644 --- a/cmd/dep/remove.go +++ b/cmd/dep/remove.go @@ -96,9 +96,9 @@ func (cmd *removeCommand) Run(ctx *dep.Ctx, loggers *Loggers, args []string) err } var rm []gps.ProjectRoot - for pr := range p.Manifest.Dependencies { + for pr := range p.Manifest.Constraints { if _, has := otherroots[pr]; !has { - delete(p.Manifest.Dependencies, pr) + delete(p.Manifest.Constraints, pr) rm = append(rm, pr) } } @@ -144,7 +144,7 @@ func (cmd *removeCommand) Run(ctx *dep.Ctx, loggers *Loggers, args []string) err } } - if _, indeps := p.Manifest.Dependencies[gps.ProjectRoot(arg)]; !indeps { + if _, indeps := p.Manifest.Constraints[gps.ProjectRoot(arg)]; !indeps { return errors.Errorf("%q is not present in the manifest, cannot remove it", arg) } @@ -155,7 +155,7 @@ func (cmd *removeCommand) Run(ctx *dep.Ctx, loggers *Loggers, args []string) err return errors.Errorf("not removing %q because it is imported by:\n\t%s (pass -force to override)", arg, strings.Join(pkgimport, "\n\t")) } - delete(p.Manifest.Dependencies, gps.ProjectRoot(arg)) + delete(p.Manifest.Constraints, gps.ProjectRoot(arg)) } } diff --git a/cmd/dep/status.go b/cmd/dep/status.go index 98ebe826d9..6441c033f9 100644 --- a/cmd/dep/status.go +++ b/cmd/dep/status.go @@ -339,7 +339,7 @@ func runStatusAll(loggers *Loggers, out outputter, p *dep.Project, sm gps.Source // Only if we have a non-rev and non-plain version do/can we display // anything wrt the version's updateability. if bs.Version != nil && bs.Version.Type() != gps.IsVersion { - c, has := p.Manifest.Dependencies[proj.Ident().ProjectRoot] + c, has := p.Manifest.Constraints[proj.Ident().ProjectRoot] if !has { c.Constraint = gps.Any() } diff --git a/manifest.go b/manifest.go index 621edf1a6a..32c6158761 100644 --- a/manifest.go +++ b/manifest.go @@ -17,17 +17,17 @@ import ( const ManifestName = "Gopkg.toml" type Manifest struct { - Dependencies gps.ProjectConstraints - Ovr gps.ProjectConstraints - Ignored []string - Required []string + Constraints gps.ProjectConstraints + Ovr gps.ProjectConstraints + Ignored []string + Required []string } type rawManifest struct { - Dependencies []rawProject `toml:"dependencies,omitempty"` - Overrides []rawProject `toml:"overrides,omitempty"` - Ignored []string `toml:"ignored,omitempty"` - Required []string `toml:"required,omitempty"` + Constraints []rawProject `toml:"constraint,omitempty"` + Overrides []rawProject `toml:"overrides,omitempty"` + Ignored []string `toml:"ignored,omitempty"` + Required []string `toml:"required,omitempty"` } type rawProject struct { @@ -56,21 +56,21 @@ func readManifest(r io.Reader) (*Manifest, error) { func fromRawManifest(raw rawManifest) (*Manifest, error) { m := &Manifest{ - Dependencies: make(gps.ProjectConstraints, len(raw.Dependencies)), - Ovr: make(gps.ProjectConstraints, len(raw.Overrides)), - Ignored: raw.Ignored, - Required: raw.Required, + Constraints: make(gps.ProjectConstraints, len(raw.Constraints)), + Ovr: make(gps.ProjectConstraints, len(raw.Overrides)), + Ignored: raw.Ignored, + Required: raw.Required, } - for i := 0; i < len(raw.Dependencies); i++ { - name, prj, err := toProject(raw.Dependencies[i]) + for i := 0; i < len(raw.Constraints); i++ { + name, prj, err := toProject(raw.Constraints[i]) if err != nil { return nil, err } - if _, exists := m.Dependencies[name]; exists { + if _, exists := m.Constraints[name]; exists { return nil, errors.Errorf("multiple dependencies specified for %s, can only specify one", name) } - m.Dependencies[name] = prj + m.Constraints[name] = prj } for i := 0; i < len(raw.Overrides); i++ { @@ -121,15 +121,15 @@ func toProject(raw rawProject) (n gps.ProjectRoot, pp gps.ProjectProperties, err // toRaw converts the manifest into a representation suitable to write to the manifest file func (m *Manifest) toRaw() rawManifest { raw := rawManifest{ - Dependencies: make([]rawProject, 0, len(m.Dependencies)), - Overrides: make([]rawProject, 0, len(m.Ovr)), - Ignored: m.Ignored, - Required: m.Required, + Constraints: make([]rawProject, 0, len(m.Constraints)), + Overrides: make([]rawProject, 0, len(m.Ovr)), + Ignored: m.Ignored, + Required: m.Required, } - for n, prj := range m.Dependencies { - raw.Dependencies = append(raw.Dependencies, toRawProject(n, prj)) + for n, prj := range m.Constraints { + raw.Constraints = append(raw.Constraints, toRawProject(n, prj)) } - sort.Sort(sortedRawProjects(raw.Dependencies)) + sort.Sort(sortedRawProjects(raw.Constraints)) for n, prj := range m.Ovr { raw.Overrides = append(raw.Overrides, toRawProject(n, prj)) @@ -193,7 +193,7 @@ func toRawProject(name gps.ProjectRoot, project gps.ProjectProperties) rawProjec } func (m *Manifest) DependencyConstraints() gps.ProjectConstraints { - return m.Dependencies + return m.Constraints } func (m *Manifest) TestDependencyConstraints() gps.ProjectConstraints { diff --git a/manifest_test.go b/manifest_test.go index 56594f41e6..bf9d0cc57f 100644 --- a/manifest_test.go +++ b/manifest_test.go @@ -26,7 +26,7 @@ func TestReadManifest(t *testing.T) { c, _ := gps.NewSemverConstraint(">=0.12.0, <1.0.0") want := Manifest{ - Dependencies: map[gps.ProjectRoot]gps.ProjectProperties{ + Constraints: map[gps.ProjectRoot]gps.ProjectProperties{ gps.ProjectRoot("github.com/golang/dep/gps"): { Constraint: c, }, @@ -43,7 +43,7 @@ func TestReadManifest(t *testing.T) { Ignored: []string{"github.com/foo/bar"}, } - if !reflect.DeepEqual(got.Dependencies, want.Dependencies) { + if !reflect.DeepEqual(got.Constraints, want.Constraints) { t.Error("Valid manifest's dependencies did not parse as expected") } if !reflect.DeepEqual(got.Ovr, want.Ovr) { @@ -62,7 +62,7 @@ func TestWriteManifest(t *testing.T) { want := h.GetTestFileString(golden) c, _ := gps.NewSemverConstraint("^v0.12.0") m := &Manifest{ - Dependencies: map[gps.ProjectRoot]gps.ProjectProperties{ + Constraints: map[gps.ProjectRoot]gps.ProjectProperties{ gps.ProjectRoot("github.com/golang/dep/gps"): { Constraint: c, }, From b76e4162e69df4d530ff391bf3d7f4eac3deebf9 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Tue, 9 May 2017 19:58:46 -0300 Subject: [PATCH 02/19] fixtures rename --- testdata/analyzer/Gopkg.toml | 4 ++-- testdata/manifest/error1.toml | 2 +- testdata/manifest/error2.toml | 4 ++-- testdata/manifest/golden.toml | 4 ++-- testdata/txn_writer/expected_manifest.toml | 10 +++++----- txn_writer.go | 8 ++++---- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/testdata/analyzer/Gopkg.toml b/testdata/analyzer/Gopkg.toml index 4f7539e628..5701e67f27 100644 --- a/testdata/analyzer/Gopkg.toml +++ b/testdata/analyzer/Gopkg.toml @@ -1,8 +1,8 @@ -[[dependencies]] +[[constraint]] name = "github.com/golang/dep/gps" version = ">=0.12.0, <1.0.0" -[[dependencies]] +[[constraint]] name = "github.com/pkg/errors" version = ">=0.8.0, <1.0.0" diff --git a/testdata/manifest/error1.toml b/testdata/manifest/error1.toml index 2cc85138a8..9257ec684e 100644 --- a/testdata/manifest/error1.toml +++ b/testdata/manifest/error1.toml @@ -1,6 +1,6 @@ ignored = ["github.com/foo/bar"] -[[dependencies]] +[[constraint]] name = "github.com/golang/dep/gps" branch = "master" revision = "d05d5aca9f895d19e9265839bffeadd74a2d2ecb" diff --git a/testdata/manifest/error2.toml b/testdata/manifest/error2.toml index 9a0f052f06..9a88ac3d00 100644 --- a/testdata/manifest/error2.toml +++ b/testdata/manifest/error2.toml @@ -1,9 +1,9 @@ ignored = ["github.com/foo/bar"] -[[dependencies]] +[constraint]] name = "github.com/golang/dep/gps" branch = "master" -[[dependencies]] +[constraint]] name = "github.com/golang/dep/gps" branch = "master" diff --git a/testdata/manifest/golden.toml b/testdata/manifest/golden.toml index 4c45e4a91d..064ea5cd0f 100644 --- a/testdata/manifest/golden.toml +++ b/testdata/manifest/golden.toml @@ -1,10 +1,10 @@ ignored = ["github.com/foo/bar"] -[[dependencies]] +[[constraint]] name = "github.com/babble/brook" revision = "d05d5aca9f895d19e9265839bffeadd74a2d2ecb" -[[dependencies]] +[[constraint]] name = "github.com/golang/dep/gps" version = ">=0.12.0, <1.0.0" diff --git a/testdata/txn_writer/expected_manifest.toml b/testdata/txn_writer/expected_manifest.toml index e0e080df27..fb6bd7194a 100644 --- a/testdata/txn_writer/expected_manifest.toml +++ b/testdata/txn_writer/expected_manifest.toml @@ -12,9 +12,9 @@ ## or in a dependency. # ignored = ["github.com/user/project/badpkg"] -## Dependencies define constraints on dependent projects. They are respected by +## Constraint define constraints on dependent projects. They are respected by ## dep whether coming from the Gopkg.toml of the current project or a dependency. -# [[dependencies]] +# [[constraint]] ## Required: the root import path of the project being constrained. # name = "github.com/user/project" # @@ -27,8 +27,8 @@ ## Optional: an alternate location (URL or import path) for the project's source. # source = "https://github.com/myfork/package.git" -## Overrides have the same structure as [[dependencies]], but supercede all -## [[dependencies]] declarations from all projects. Only the current project's +## Overrides have the same structure as [[constraint]], but supercede all +## [[constraint]] declarations from all projects. Only the current project's ## [[overrides]] are applied. ## ## Overrides are a sledgehammer. Use them only as a last resort. @@ -51,6 +51,6 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/dep-test" version = "1.0.0" diff --git a/txn_writer.go b/txn_writer.go index 8fde40d8f1..080e4413ef 100644 --- a/txn_writer.go +++ b/txn_writer.go @@ -36,9 +36,9 @@ const exampleTOML = ` ## or in a dependency. # ignored = ["github.com/user/project/badpkg"] -## Dependencies define constraints on dependent projects. They are respected by +## Constraint define constraints on dependent projects. They are respected by ## dep whether coming from the Gopkg.toml of the current project or a dependency. -# [[dependencies]] +# [[constraint]] ## Required: the root import path of the project being constrained. # name = "github.com/user/project" # @@ -51,8 +51,8 @@ const exampleTOML = ` ## Optional: an alternate location (URL or import path) for the project's source. # source = "https://github.com/myfork/package.git" -## Overrides have the same structure as [[dependencies]], but supercede all -## [[dependencies]] declarations from all projects. Only the current project's +## Overrides have the same structure as [[constraint]], but supercede all +## [[constraint]] declarations from all projects. Only the current project's ## [[overrides]] are applied. ## ## Overrides are a sledgehammer. Use them only as a last resort. From 942792af413023d3d7c8781e6d1a3a5a0cd27474 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Tue, 9 May 2017 20:13:26 -0300 Subject: [PATCH 03/19] fix tests --- context_test.go | 8 ++++---- testdata/manifest/error2.toml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/context_test.go b/context_test.go index 9372b597c2..d06a2eff98 100644 --- a/context_test.go +++ b/context_test.go @@ -269,7 +269,7 @@ func TestLoadProjectManifestParseError(t *testing.T) { tg.TempDir("src") tg.TempDir("src/test1") - tg.TempFile(filepath.Join("src/test1", ManifestName), `[[dependencies]]`) + tg.TempFile(filepath.Join("src/test1", ManifestName), `[[constraint]]`) tg.TempFile(filepath.Join("src/test1", LockName), `memo = "cdafe8641b28cd16fe025df278b0a49b9416859345d8b6ba0ace0272b74925ee"\n\n[[projects]]`) tg.Setenv("GOPATH", tg.Path(".")) @@ -295,7 +295,7 @@ func TestLoadProjectLockParseError(t *testing.T) { tg.TempDir("src") tg.TempDir("src/test1") - tg.TempFile(filepath.Join("src/test1", ManifestName), `[[dependencies]]`) + tg.TempFile(filepath.Join("src/test1", ManifestName), `[[constraint]]`) tg.TempFile(filepath.Join("src/test1", LockName), `memo = "cdafe8641b28cd16fe025df278b0a49b9416859345d8b6ba0ace0272b74925ee"\n\n[[projects]]`) tg.Setenv("GOPATH", tg.Path(".")) @@ -320,7 +320,7 @@ func TestLoadProjectNoSrcDir(t *testing.T) { defer tg.Cleanup() tg.TempDir("test1") - tg.TempFile(filepath.Join("test1", ManifestName), `[[dependencies]]`) + tg.TempFile(filepath.Join("test1", ManifestName), `[[constraint]]`) tg.TempFile(filepath.Join("test1", LockName), `memo = "cdafe8641b28cd16fe025df278b0a49b9416859345d8b6ba0ace0272b74925ee"\n\n[[projects]]`) tg.Setenv("GOPATH", tg.Path(".")) @@ -349,7 +349,7 @@ func TestCaseInsentitiveGOPATH(t *testing.T) { h.TempDir("src") h.TempDir("src/test1") - h.TempFile(filepath.Join("src/test1", ManifestName), `[[dependencies]]`) + h.TempFile(filepath.Join("src/test1", ManifestName), `[[constraint]]`) // Shuffle letter case rs := []rune(strings.ToLower(h.Path("."))) diff --git a/testdata/manifest/error2.toml b/testdata/manifest/error2.toml index 9a88ac3d00..2965640a96 100644 --- a/testdata/manifest/error2.toml +++ b/testdata/manifest/error2.toml @@ -1,9 +1,9 @@ ignored = ["github.com/foo/bar"] -[constraint]] +[[constraint]] name = "github.com/golang/dep/gps" branch = "master" -[constraint]] +[[constraint]] name = "github.com/golang/dep/gps" branch = "master" From bb8a327810ea9119a5c461cd39b7b9fb219e4d2d Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Tue, 9 May 2017 20:50:28 -0300 Subject: [PATCH 04/19] update Gopkg.toml --- Gopkg.toml | 8 ++++---- .../harness_tests/ensure/empty/case1/final/Gopkg.toml | 10 +++++----- .../harness_tests/ensure/empty/case2/final/Gopkg.toml | 2 +- .../ensure/empty/case2/initial/Gopkg.toml | 2 +- .../harness_tests/ensure/empty/case3/final/Gopkg.toml | 2 +- .../ensure/empty/case3/initial/Gopkg.toml | 2 +- .../ensure/override/case1/final/Gopkg.toml | 10 +++++----- .../harness_tests/ensure/update/case1/final/Gopkg.toml | 2 +- .../ensure/update/case1/initial/Gopkg.toml | 2 +- .../harness_tests/ensure/update/case2/final/Gopkg.toml | 2 +- .../ensure/update/case2/initial/Gopkg.toml | 2 +- .../testdata/harness_tests/init/case1/final/Gopkg.toml | 4 ++-- .../testdata/harness_tests/init/case2/final/Gopkg.toml | 4 ++-- .../testdata/harness_tests/init/case3/final/Gopkg.toml | 4 ++-- .../harness_tests/init/skip-hidden/final/Gopkg.toml | 2 +- .../harness_tests/remove/force/case1/final/Gopkg.toml | 6 +++--- .../remove/force/case1/initial/Gopkg.toml | 6 +++--- .../remove/specific/case1/final/Gopkg.toml | 6 +++--- .../remove/specific/case1/initial/Gopkg.toml | 6 +++--- .../remove/specific/case2/final/Gopkg.toml | 6 +++--- .../remove/specific/case2/initial/Gopkg.toml | 6 +++--- .../harness_tests/remove/unused/case1/final/Gopkg.toml | 6 +++--- .../remove/unused/case1/initial/Gopkg.toml | 6 +++--- .../harness_tests/status/case1/final/Gopkg.toml | 2 +- .../harness_tests/status/case1/initial/Gopkg.toml | 2 +- 25 files changed, 55 insertions(+), 55 deletions(-) diff --git a/Gopkg.toml b/Gopkg.toml index 26c6b5de3f..94bb6dc2ee 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,17 +1,17 @@ required = ["github.com/Masterminds/semver"] -[[dependencies]] +[[constraint]] branch = "2.x" name = "github.com/Masterminds/semver" -[[dependencies]] +[[constraint]] name = "github.com/Masterminds/vcs" version = "^1.11.0" -[[dependencies]] +[[constraint]] branch = "master" name = "github.com/pelletier/go-toml" -[[dependencies]] +[[constraint]] name = "github.com/pkg/errors" version = ">=0.8.0, <1.0.0" diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.toml index 26987273ec..3eb781f37c 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.toml @@ -12,9 +12,9 @@ ## or in a dependency. # ignored = ["github.com/user/project/badpkg"] -## Dependencies define constraints on dependent projects. They are respected by +## Constraint define constraints on dependent projects. They are respected by ## dep whether coming from the Gopkg.toml of the current project or a dependency. -# [[dependencies]] +# [[constraint]] ## Required: the root import path of the project being constrained. # name = "github.com/user/project" # @@ -27,8 +27,8 @@ ## Optional: an alternate location (URL or import path) for the project's source. # source = "https://github.com/myfork/package.git" -## Overrides have the same structure as [[dependencies]], but supercede all -## [[dependencies]] declarations from all projects. Only the current project's +## Overrides have the same structure as [[constraint]], but supercede all +## [[constraint]] declarations from all projects. Only the current project's ## [[overrides]] are applied. ## ## Overrides are a sledgehammer. Use them only as a last resort. @@ -51,6 +51,6 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = "^1.0.0" diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.toml index d327c51ade..532da96a0d 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.toml @@ -1,3 +1,3 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = "~0.8.0" \ No newline at end of file diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case2/initial/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/empty/case2/initial/Gopkg.toml index d327c51ade..532da96a0d 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case2/initial/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case2/initial/Gopkg.toml @@ -1,3 +1,3 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = "~0.8.0" \ No newline at end of file diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.toml index dd0150055a..d77e367c70 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.toml @@ -1,5 +1,5 @@ ignored = ["github.com/sdboyer/deptestdos"] -[[dependencies]] +[[constraint]] branch = "master" name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case3/initial/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/empty/case3/initial/Gopkg.toml index dd0150055a..d77e367c70 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case3/initial/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case3/initial/Gopkg.toml @@ -1,5 +1,5 @@ ignored = ["github.com/sdboyer/deptestdos"] -[[dependencies]] +[[constraint]] branch = "master" name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.toml index 26987273ec..3eb781f37c 100644 --- a/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.toml @@ -12,9 +12,9 @@ ## or in a dependency. # ignored = ["github.com/user/project/badpkg"] -## Dependencies define constraints on dependent projects. They are respected by +## Constraint define constraints on dependent projects. They are respected by ## dep whether coming from the Gopkg.toml of the current project or a dependency. -# [[dependencies]] +# [[constraint]] ## Required: the root import path of the project being constrained. # name = "github.com/user/project" # @@ -27,8 +27,8 @@ ## Optional: an alternate location (URL or import path) for the project's source. # source = "https://github.com/myfork/package.git" -## Overrides have the same structure as [[dependencies]], but supercede all -## [[dependencies]] declarations from all projects. Only the current project's +## Overrides have the same structure as [[constraint]], but supercede all +## [[constraint]] declarations from all projects. Only the current project's ## [[overrides]] are applied. ## ## Overrides are a sledgehammer. Use them only as a last resort. @@ -51,6 +51,6 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = "^1.0.0" diff --git a/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.toml index d327c51ade..532da96a0d 100644 --- a/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.toml @@ -1,3 +1,3 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = "~0.8.0" \ No newline at end of file diff --git a/cmd/dep/testdata/harness_tests/ensure/update/case1/initial/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/update/case1/initial/Gopkg.toml index d327c51ade..532da96a0d 100644 --- a/cmd/dep/testdata/harness_tests/ensure/update/case1/initial/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/update/case1/initial/Gopkg.toml @@ -1,3 +1,3 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = "~0.8.0" \ No newline at end of file diff --git a/cmd/dep/testdata/harness_tests/ensure/update/case2/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/update/case2/final/Gopkg.toml index d327c51ade..532da96a0d 100644 --- a/cmd/dep/testdata/harness_tests/ensure/update/case2/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/update/case2/final/Gopkg.toml @@ -1,3 +1,3 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = "~0.8.0" \ No newline at end of file diff --git a/cmd/dep/testdata/harness_tests/ensure/update/case2/initial/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/update/case2/initial/Gopkg.toml index d327c51ade..532da96a0d 100644 --- a/cmd/dep/testdata/harness_tests/ensure/update/case2/initial/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/update/case2/initial/Gopkg.toml @@ -1,3 +1,3 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = "~0.8.0" \ No newline at end of file diff --git a/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.toml index 0681d4cf62..94d7d12f6c 100644 --- a/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.toml @@ -1,7 +1,7 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = ">=0.8.0, <1.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptestdos" diff --git a/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.toml index 487298ca78..9a4ce3ddfb 100644 --- a/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.toml @@ -1,8 +1,8 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = ">=0.8.0, <1.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptestdos" version = "^2.0.0" diff --git a/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.toml index bccfadb86a..d29981452a 100644 --- a/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.toml @@ -1,7 +1,7 @@ -[[dependencies]] +[[constraint]] branch = "master" name = "github.com/sdboyer/deptest" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptestdos" diff --git a/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.toml index d5f3e3c9d6..d762176664 100644 --- a/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.toml @@ -1,4 +1,4 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = "^1.0.0" diff --git a/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.toml index 413feb4eb0..3b1781b8ae 100644 --- a/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.toml @@ -1,11 +1,11 @@ -[[dependencies]] +[[constraint]] name = "github.com/not/used" version = "2.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = ">=0.8.0, <1.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptestdos" revision = "a0196baa11ea047dd65037287451d36b861b00ea" diff --git a/cmd/dep/testdata/harness_tests/remove/force/case1/initial/Gopkg.toml b/cmd/dep/testdata/harness_tests/remove/force/case1/initial/Gopkg.toml index 413feb4eb0..3b1781b8ae 100644 --- a/cmd/dep/testdata/harness_tests/remove/force/case1/initial/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/remove/force/case1/initial/Gopkg.toml @@ -1,11 +1,11 @@ -[[dependencies]] +[[constraint]] name = "github.com/not/used" version = "2.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = ">=0.8.0, <1.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptestdos" revision = "a0196baa11ea047dd65037287451d36b861b00ea" diff --git a/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.toml index 26653704de..a1d5829085 100644 --- a/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.toml @@ -1,11 +1,11 @@ -[[dependencies]] +[[constraint]] name = "github.com/not/used" version = "2.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = ">=0.8.0, <1.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptestdos" revision = "a0196baa11ea047dd65037287451d36b861b00ea" \ No newline at end of file diff --git a/cmd/dep/testdata/harness_tests/remove/specific/case1/initial/Gopkg.toml b/cmd/dep/testdata/harness_tests/remove/specific/case1/initial/Gopkg.toml index 26653704de..a1d5829085 100644 --- a/cmd/dep/testdata/harness_tests/remove/specific/case1/initial/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/remove/specific/case1/initial/Gopkg.toml @@ -1,11 +1,11 @@ -[[dependencies]] +[[constraint]] name = "github.com/not/used" version = "2.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = ">=0.8.0, <1.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptestdos" revision = "a0196baa11ea047dd65037287451d36b861b00ea" \ No newline at end of file diff --git a/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.toml index 0bb0ab1d1b..471431e22a 100644 --- a/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.toml @@ -1,11 +1,11 @@ -[[dependencies]] +[[constraint]] name = "github.com/not/used" version = "2.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = ">=0.8.0, <1.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptestdos" revision = "a0196baa11ea047dd65037287451d36b861b00ea" \ No newline at end of file diff --git a/cmd/dep/testdata/harness_tests/remove/specific/case2/initial/Gopkg.toml b/cmd/dep/testdata/harness_tests/remove/specific/case2/initial/Gopkg.toml index 0bb0ab1d1b..471431e22a 100644 --- a/cmd/dep/testdata/harness_tests/remove/specific/case2/initial/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/remove/specific/case2/initial/Gopkg.toml @@ -1,11 +1,11 @@ -[[dependencies]] +[[constraint]] name = "github.com/not/used" version = "2.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = ">=0.8.0, <1.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptestdos" revision = "a0196baa11ea047dd65037287451d36b861b00ea" \ No newline at end of file diff --git a/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.toml index 0bb0ab1d1b..471431e22a 100644 --- a/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.toml @@ -1,11 +1,11 @@ -[[dependencies]] +[[constraint]] name = "github.com/not/used" version = "2.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = ">=0.8.0, <1.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptestdos" revision = "a0196baa11ea047dd65037287451d36b861b00ea" \ No newline at end of file diff --git a/cmd/dep/testdata/harness_tests/remove/unused/case1/initial/Gopkg.toml b/cmd/dep/testdata/harness_tests/remove/unused/case1/initial/Gopkg.toml index 0bb0ab1d1b..471431e22a 100644 --- a/cmd/dep/testdata/harness_tests/remove/unused/case1/initial/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/remove/unused/case1/initial/Gopkg.toml @@ -1,11 +1,11 @@ -[[dependencies]] +[[constraint]] name = "github.com/not/used" version = "2.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = ">=0.8.0, <1.0.0" -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptestdos" revision = "a0196baa11ea047dd65037287451d36b861b00ea" \ No newline at end of file diff --git a/cmd/dep/testdata/harness_tests/status/case1/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/status/case1/final/Gopkg.toml index 122d0340fd..94deb714a4 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/status/case1/final/Gopkg.toml @@ -1,3 +1,3 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = "^0.8.0" diff --git a/cmd/dep/testdata/harness_tests/status/case1/initial/Gopkg.toml b/cmd/dep/testdata/harness_tests/status/case1/initial/Gopkg.toml index 122d0340fd..94deb714a4 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/initial/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/status/case1/initial/Gopkg.toml @@ -1,3 +1,3 @@ -[[dependencies]] +[[constraint]] name = "github.com/sdboyer/deptest" version = "^0.8.0" From 5cb3e51de7046eba9ee6f636e97365188a2dc1b2 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Wed, 10 May 2017 01:07:50 -0300 Subject: [PATCH 05/19] rename [[overrides]] to [[override]] --- .../harness_tests/ensure/empty/case1/final/Gopkg.toml | 11 ++++++----- .../ensure/override/case1/final/Gopkg.toml | 11 ++++++----- manifest.go | 2 +- testdata/manifest/error1.toml | 2 +- testdata/manifest/golden.toml | 2 +- testdata/txn_writer/expected_manifest.toml | 11 ++++++----- txn_writer.go | 11 ++++++----- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.toml index 3eb781f37c..d9f28256a2 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.toml @@ -12,7 +12,8 @@ ## or in a dependency. # ignored = ["github.com/user/project/badpkg"] -## Constraint define constraints on dependent projects. They are respected by +## Constraints are rules for how directly imported projects +## may be incorporated into the depgraph. They are respected by ## dep whether coming from the Gopkg.toml of the current project or a dependency. # [[constraint]] ## Required: the root import path of the project being constrained. @@ -27,12 +28,12 @@ ## Optional: an alternate location (URL or import path) for the project's source. # source = "https://github.com/myfork/package.git" -## Overrides have the same structure as [[constraint]], but supercede all +## Override have the same structure as [[constraint]], but supercede all ## [[constraint]] declarations from all projects. Only the current project's -## [[overrides]] are applied. +## [[override]] is applied. ## -## Overrides are a sledgehammer. Use them only as a last resort. -# [[overrides]] +## Override is a sledgehammer. Use them only as a last resort. +# [[override]] ## Required: the root import path of the project being constrained. # name = "github.com/user/project" # diff --git a/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.toml index 3eb781f37c..d9f28256a2 100644 --- a/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.toml @@ -12,7 +12,8 @@ ## or in a dependency. # ignored = ["github.com/user/project/badpkg"] -## Constraint define constraints on dependent projects. They are respected by +## Constraints are rules for how directly imported projects +## may be incorporated into the depgraph. They are respected by ## dep whether coming from the Gopkg.toml of the current project or a dependency. # [[constraint]] ## Required: the root import path of the project being constrained. @@ -27,12 +28,12 @@ ## Optional: an alternate location (URL or import path) for the project's source. # source = "https://github.com/myfork/package.git" -## Overrides have the same structure as [[constraint]], but supercede all +## Override have the same structure as [[constraint]], but supercede all ## [[constraint]] declarations from all projects. Only the current project's -## [[overrides]] are applied. +## [[override]] is applied. ## -## Overrides are a sledgehammer. Use them only as a last resort. -# [[overrides]] +## Override is a sledgehammer. Use them only as a last resort. +# [[override]] ## Required: the root import path of the project being constrained. # name = "github.com/user/project" # diff --git a/manifest.go b/manifest.go index 32c6158761..ebde1a2078 100644 --- a/manifest.go +++ b/manifest.go @@ -25,7 +25,7 @@ type Manifest struct { type rawManifest struct { Constraints []rawProject `toml:"constraint,omitempty"` - Overrides []rawProject `toml:"overrides,omitempty"` + Overrides []rawProject `toml:"override,omitempty"` Ignored []string `toml:"ignored,omitempty"` Required []string `toml:"required,omitempty"` } diff --git a/testdata/manifest/error1.toml b/testdata/manifest/error1.toml index 9257ec684e..4f76844011 100644 --- a/testdata/manifest/error1.toml +++ b/testdata/manifest/error1.toml @@ -7,7 +7,7 @@ ignored = ["github.com/foo/bar"] version = "^v0.12.0" source = "https://github.com/golang/dep/gps" -[[overrides]] +[[override]] name = "github.com/golang/dep/gps" branch = "master" revision = "d05d5aca9f895d19e9265839bffeadd74a2d2ecb" diff --git a/testdata/manifest/golden.toml b/testdata/manifest/golden.toml index 064ea5cd0f..a947b8a987 100644 --- a/testdata/manifest/golden.toml +++ b/testdata/manifest/golden.toml @@ -8,7 +8,7 @@ ignored = ["github.com/foo/bar"] name = "github.com/golang/dep/gps" version = ">=0.12.0, <1.0.0" -[[overrides]] +[[override]] branch = "master" name = "github.com/golang/dep/gps" source = "https://github.com/golang/dep/gps" diff --git a/testdata/txn_writer/expected_manifest.toml b/testdata/txn_writer/expected_manifest.toml index fb6bd7194a..440555b00f 100644 --- a/testdata/txn_writer/expected_manifest.toml +++ b/testdata/txn_writer/expected_manifest.toml @@ -12,7 +12,8 @@ ## or in a dependency. # ignored = ["github.com/user/project/badpkg"] -## Constraint define constraints on dependent projects. They are respected by +## Constraints are rules for how directly imported projects +## may be incorporated into the depgraph. They are respected by ## dep whether coming from the Gopkg.toml of the current project or a dependency. # [[constraint]] ## Required: the root import path of the project being constrained. @@ -27,12 +28,12 @@ ## Optional: an alternate location (URL or import path) for the project's source. # source = "https://github.com/myfork/package.git" -## Overrides have the same structure as [[constraint]], but supercede all +## Override have the same structure as [[constraint]], but supercede all ## [[constraint]] declarations from all projects. Only the current project's -## [[overrides]] are applied. +## [[override]] is applied. ## -## Overrides are a sledgehammer. Use them only as a last resort. -# [[overrides]] +## Override is a sledgehammer. Use them only as a last resort. +# [[override]] ## Required: the root import path of the project being constrained. # name = "github.com/user/project" # diff --git a/txn_writer.go b/txn_writer.go index 080e4413ef..f7ef11b384 100644 --- a/txn_writer.go +++ b/txn_writer.go @@ -36,7 +36,8 @@ const exampleTOML = ` ## or in a dependency. # ignored = ["github.com/user/project/badpkg"] -## Constraint define constraints on dependent projects. They are respected by +## Constraints are rules for how directly imported projects +## may be incorporated into the depgraph. They are respected by ## dep whether coming from the Gopkg.toml of the current project or a dependency. # [[constraint]] ## Required: the root import path of the project being constrained. @@ -51,12 +52,12 @@ const exampleTOML = ` ## Optional: an alternate location (URL or import path) for the project's source. # source = "https://github.com/myfork/package.git" -## Overrides have the same structure as [[constraint]], but supercede all +## Override have the same structure as [[constraint]], but supercede all ## [[constraint]] declarations from all projects. Only the current project's -## [[overrides]] are applied. +## [[override]] is applied. ## -## Overrides are a sledgehammer. Use them only as a last resort. -# [[overrides]] +## Override is a sledgehammer. Use them only as a last resort. +# [[override]] ## Required: the root import path of the project being constrained. # name = "github.com/user/project" # From 8be9bb629bc165bfd14701166347b2d506a05cb0 Mon Sep 17 00:00:00 2001 From: sam boyer Date: Mon, 15 May 2017 23:05:45 -0400 Subject: [PATCH 06/19] Split input components out in Gopkg.lock --- cmd/dep/init.go | 2 +- cmd/dep/prune.go | 2 +- cmd/dep/status.go | 2 +- .../ensure/empty/case1/final/Gopkg.lock | 6 ++- .../ensure/empty/case1/testcase.json | 1 + .../ensure/empty/case2/final/Gopkg.lock | 6 ++- .../ensure/empty/case2/testcase.json | 1 + .../ensure/empty/case3/final/Gopkg.lock | 6 ++- .../ensure/empty/case3/testcase.json | 1 + .../ensure/override/case1/final/Gopkg.lock | 6 ++- .../ensure/override/case1/testcase.json | 1 + .../ensure/pkg-errors/case1/final/Gopkg.lock | 6 ++- .../ensure/pkg-errors/case1/testcase.json | 13 ++--- .../ensure/update/case1/final/Gopkg.lock | 6 ++- .../ensure/update/case1/testcase.json | 1 + .../ensure/update/case2/testcase.json | 1 + .../harness_tests/init/case1/final/Gopkg.lock | 6 ++- .../harness_tests/init/case1/testcase.json | 1 + .../harness_tests/init/case2/final/Gopkg.lock | 6 ++- .../harness_tests/init/case2/testcase.json | 1 + .../harness_tests/init/case3/final/Gopkg.lock | 6 ++- .../harness_tests/init/case3/testcase.json | 1 + .../init/manifest-exists/testcase.json | 11 ++-- .../init/skip-hidden/final/Gopkg.lock | 6 ++- .../init/skip-hidden/testcase.json | 1 + .../remove/force/case1/final/Gopkg.lock | 6 ++- .../remove/force/case1/testcase.json | 1 + .../remove/specific/case1/final/Gopkg.lock | 6 ++- .../remove/specific/case1/testcase.json | 1 + .../remove/specific/case2/final/Gopkg.lock | 6 ++- .../remove/specific/case2/testcase.json | 1 + .../remove/unused/case1/final/Gopkg.lock | 6 ++- .../remove/unused/case1/testcase.json | 1 + .../status/case1/dot/final/Gopkg.lock | 6 ++- .../status/case1/dot/testcase.json | 3 +- .../status/case1/json/final/Gopkg.lock | 6 ++- .../status/case1/json/testcase.json | 3 +- .../status/case1/table/final/Gopkg.lock | 6 ++- .../status/case1/table/testcase.json | 1 + internal/gps/result.go | 18 +++++++ internal/gps/result_test.go | 1 + internal/gps/solver.go | 2 +- lock.go | 50 +++++++++++++------ lock_test.go | 16 ++++-- testdata/lock/error1.toml | 1 + testdata/lock/golden0.toml | 6 ++- testdata/lock/golden1.toml | 6 ++- testdata/txn_writer/expected_diff_output.txt | 2 - testdata/txn_writer/expected_lock.toml | 6 ++- txn_writer_test.go | 4 +- 50 files changed, 204 insertions(+), 61 deletions(-) diff --git a/cmd/dep/init.go b/cmd/dep/init.go index efc0863ee8..ac849c4d12 100644 --- a/cmd/dep/init.go +++ b/cmd/dep/init.go @@ -211,7 +211,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error { return errors.Wrap(err, "prepare solver") } - l.Memo = s.HashInputs() + l.Inputs.Memo = s.HashInputs() // Pass timestamp (yyyyMMddHHmmss format) as suffix to backup name. vendorbak, err := dep.BackupVendor(vpath, time.Now().Format("20060102150405")) diff --git a/cmd/dep/prune.go b/cmd/dep/prune.go index cd59655160..d2d0614ab7 100644 --- a/cmd/dep/prune.go +++ b/cmd/dep/prune.go @@ -68,7 +68,7 @@ func (cmd *pruneCommand) Run(ctx *dep.Ctx, args []string) error { return errors.Wrap(err, "could not set up solver for input hashing") } - if !bytes.Equal(s.HashInputs(), p.Lock.Memo) { + if !bytes.Equal(s.HashInputs(), p.Lock.Inputs.Memo) { return fmt.Errorf("lock hash doesn't match") } diff --git a/cmd/dep/status.go b/cmd/dep/status.go index 57d5440a50..68e7238da5 100644 --- a/cmd/dep/status.go +++ b/cmd/dep/status.go @@ -277,7 +277,7 @@ func runStatusAll(loggers *dep.Loggers, out outputter, p *dep.Project, sm gps.So slp := p.Lock.Projects() sort.Sort(dep.SortedLockedProjects(slp)) - if bytes.Equal(s.HashInputs(), p.Lock.Memo) { + if bytes.Equal(s.HashInputs(), p.Lock.Inputs.Memo) { // If these are equal, we're guaranteed that the lock is a transitively // complete picture of all deps. That eliminates the need for at least // some checks. diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.lock index 2b9c20975d..6cb2e0ddf8 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case1/testcase.json b/cmd/dep/testdata/harness_tests/ensure/empty/case1/testcase.json index 515a342de3..ba9b088aa5 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case1/testcase.json +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case1/testcase.json @@ -3,6 +3,7 @@ ["init"], ["ensure", "-update"] ], + "error-expected": "", "vendor-final": [ "github.com/sdboyer/deptest" ] diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.lock index 3c588e4d62..87bee3fda5 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "e7725ea56516a42a641aaaf5d48754258d9f3c59949cb8a0e8a21b1ab6e07179" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "e7725ea56516a42a641aaaf5d48754258d9f3c59949cb8a0e8a21b1ab6e07179" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case2/testcase.json b/cmd/dep/testdata/harness_tests/ensure/empty/case2/testcase.json index 19da527090..729de9d0f4 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case2/testcase.json +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case2/testcase.json @@ -2,6 +2,7 @@ "commands": [ ["ensure"] ], + "error-expected": "", "vendor-final": [ "github.com/sdboyer/deptest" ] diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.lock index 4fc4f785c5..2c4f895ae2 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "e5c16e09ed6f0a1a2b3cf472c34b7fd50861dd070e81d5e623f72e8173f0c065" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "e5c16e09ed6f0a1a2b3cf472c34b7fd50861dd070e81d5e623f72e8173f0c065" [[projects]] branch = "master" diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case3/testcase.json b/cmd/dep/testdata/harness_tests/ensure/empty/case3/testcase.json index 19da527090..729de9d0f4 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case3/testcase.json +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case3/testcase.json @@ -2,6 +2,7 @@ "commands": [ ["ensure"] ], + "error-expected": "", "vendor-final": [ "github.com/sdboyer/deptest" ] diff --git a/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock index e045b6b22c..c3726a002b 100644 --- a/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "8bca9526e654e56e05d9075d1f33fa5b649bf6d58aa7d71ca39e7fbea8468e07" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "8bca9526e654e56e05d9075d1f33fa5b649bf6d58aa7d71ca39e7fbea8468e07" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/ensure/override/case1/testcase.json b/cmd/dep/testdata/harness_tests/ensure/override/case1/testcase.json index c66b07ff04..efbbc392f7 100644 --- a/cmd/dep/testdata/harness_tests/ensure/override/case1/testcase.json +++ b/cmd/dep/testdata/harness_tests/ensure/override/case1/testcase.json @@ -3,6 +3,7 @@ ["init"], ["ensure", "-override", "github.com/sdboyer/deptest@1.0.0"] ], + "error-expected": "", "vendor-final": [ "github.com/sdboyer/deptest" ] diff --git a/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock index 70280d1ade..d5f19c45fe 100644 --- a/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock @@ -1 +1,5 @@ -memo = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7" diff --git a/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/testcase.json b/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/testcase.json index d3635f8d62..111c48e755 100644 --- a/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/testcase.json +++ b/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/testcase.json @@ -1,7 +1,8 @@ { - "commands": [ - ["init", "-no-examples"], - ["ensure", "-update"] - ], - "error-expected" : "all dirs lacked any go code" - } + "commands": [ + ["init", "-no-examples"], + ["ensure", "-update"] + ], + "error-expected": "all dirs lacked any go code", + "vendor-final": [] +} diff --git a/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.lock index b808a70fc4..b898609181 100644 --- a/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/ensure/update/case1/testcase.json b/cmd/dep/testdata/harness_tests/ensure/update/case1/testcase.json index cb357104b5..07bc635269 100644 --- a/cmd/dep/testdata/harness_tests/ensure/update/case1/testcase.json +++ b/cmd/dep/testdata/harness_tests/ensure/update/case1/testcase.json @@ -2,6 +2,7 @@ "commands": [ ["ensure", "-update", "github.com/sdboyer/deptest"] ], + "error-expected": "", "vendor-final": [ "github.com/sdboyer/deptest", "github.com/sdboyer/deptestdos" diff --git a/cmd/dep/testdata/harness_tests/ensure/update/case2/testcase.json b/cmd/dep/testdata/harness_tests/ensure/update/case2/testcase.json index aa86ad32f3..f0ac6111e5 100644 --- a/cmd/dep/testdata/harness_tests/ensure/update/case2/testcase.json +++ b/cmd/dep/testdata/harness_tests/ensure/update/case2/testcase.json @@ -2,5 +2,6 @@ "commands": [ ["ensure", "-n", "-update", "github.com/sdboyer/deptest"] ], + "error-expected": "", "vendor-final": [] } diff --git a/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock index d43aa9f9ac..226b7b58a8 100644 --- a/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/init/case1/testcase.json b/cmd/dep/testdata/harness_tests/init/case1/testcase.json index ea0ff80424..d1d4585460 100644 --- a/cmd/dep/testdata/harness_tests/init/case1/testcase.json +++ b/cmd/dep/testdata/harness_tests/init/case1/testcase.json @@ -2,6 +2,7 @@ "commands": [ ["init", "-no-examples"] ], + "error-expected": "", "gopath-initial": { "github.com/sdboyer/deptest": "v0.8.0", "github.com/sdboyer/deptestdos": "a0196baa11ea047dd65037287451d36b861b00ea" diff --git a/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock index 50ed86f68e..6ca80abf05 100644 --- a/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "b4fe6e8bceac924197838b6ea47989abbdd3a8d31035d20ee0a1dabc0994c368" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "b4fe6e8bceac924197838b6ea47989abbdd3a8d31035d20ee0a1dabc0994c368" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/init/case2/testcase.json b/cmd/dep/testdata/harness_tests/init/case2/testcase.json index 3f3140bc04..e16b746d4b 100644 --- a/cmd/dep/testdata/harness_tests/init/case2/testcase.json +++ b/cmd/dep/testdata/harness_tests/init/case2/testcase.json @@ -2,6 +2,7 @@ "commands": [ ["init", "-no-examples"] ], + "error-expected": "", "gopath-initial": { "github.com/sdboyer/deptest": "v0.8.0" }, diff --git a/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock index 465f59501e..7dd1c59f38 100644 --- a/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "af9a783a5430dabcaaf44683c09e2b729e1c0d61f13bfdf6677c4fd0b41387ca" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "af9a783a5430dabcaaf44683c09e2b729e1c0d61f13bfdf6677c4fd0b41387ca" [[projects]] branch = "master" diff --git a/cmd/dep/testdata/harness_tests/init/case3/testcase.json b/cmd/dep/testdata/harness_tests/init/case3/testcase.json index 13cba35aeb..d3a92a55e2 100644 --- a/cmd/dep/testdata/harness_tests/init/case3/testcase.json +++ b/cmd/dep/testdata/harness_tests/init/case3/testcase.json @@ -2,6 +2,7 @@ "commands": [ ["init", "-no-examples"] ], + "error-expected": "", "gopath-initial": { "github.com/sdboyer/deptestdos": "a0196baa11ea047dd65037287451d36b861b00ea" }, diff --git a/cmd/dep/testdata/harness_tests/init/manifest-exists/testcase.json b/cmd/dep/testdata/harness_tests/init/manifest-exists/testcase.json index 08322d2a49..3958059fbb 100644 --- a/cmd/dep/testdata/harness_tests/init/manifest-exists/testcase.json +++ b/cmd/dep/testdata/harness_tests/init/manifest-exists/testcase.json @@ -1,6 +1,7 @@ { - "commands": [ - ["init"] - ], - "error-expected" : "manifest already exists:" - } \ No newline at end of file + "commands": [ + ["init"] + ], + "error-expected": "manifest already exists:", + "vendor-final": [] +} diff --git a/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.lock index 2b9c20975d..6cb2e0ddf8 100644 --- a/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/init/skip-hidden/testcase.json b/cmd/dep/testdata/harness_tests/init/skip-hidden/testcase.json index 283604258a..5e4c2bb85d 100644 --- a/cmd/dep/testdata/harness_tests/init/skip-hidden/testcase.json +++ b/cmd/dep/testdata/harness_tests/init/skip-hidden/testcase.json @@ -2,6 +2,7 @@ "commands": [ ["init", "-no-examples"] ], + "error-expected": "", "vendor-final": [ "github.com/sdboyer/deptest" ] diff --git a/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.lock index 03b152c335..6f19daa4bc 100644 --- a/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/remove/force/case1/testcase.json b/cmd/dep/testdata/harness_tests/remove/force/case1/testcase.json index 84447c9b42..ac4dbf2547 100644 --- a/cmd/dep/testdata/harness_tests/remove/force/case1/testcase.json +++ b/cmd/dep/testdata/harness_tests/remove/force/case1/testcase.json @@ -2,6 +2,7 @@ "commands": [ ["remove", "-force", "github.com/sdboyer/deptestdos", "github.com/not/used"] ], + "error-expected": "", "vendor-final": [ "github.com/sdboyer/deptest", "github.com/sdboyer/deptestdos" diff --git a/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock index 89372cc518..6782040d3a 100644 --- a/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/remove/specific/case1/testcase.json b/cmd/dep/testdata/harness_tests/remove/specific/case1/testcase.json index 327867d481..5b44542ae1 100644 --- a/cmd/dep/testdata/harness_tests/remove/specific/case1/testcase.json +++ b/cmd/dep/testdata/harness_tests/remove/specific/case1/testcase.json @@ -2,6 +2,7 @@ "commands": [ ["remove", "github.com/not/used"] ], + "error-expected": "", "vendor-final": [ "github.com/sdboyer/deptest", "github.com/sdboyer/deptestdos" diff --git a/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock index cb091e429d..c1b9827d32 100644 --- a/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "38d8431865759ee3bf28fbdfc464f98ee8b56319394ec717df45e9969544cfca" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "38d8431865759ee3bf28fbdfc464f98ee8b56319394ec717df45e9969544cfca" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/remove/specific/case2/testcase.json b/cmd/dep/testdata/harness_tests/remove/specific/case2/testcase.json index 1a5f806b6c..db915f38ad 100644 --- a/cmd/dep/testdata/harness_tests/remove/specific/case2/testcase.json +++ b/cmd/dep/testdata/harness_tests/remove/specific/case2/testcase.json @@ -2,6 +2,7 @@ "commands": [ ["remove", "github.com/not/used"] ], + "error-expected": "", "vendor-initial": { "github.com/sdboyer/deptest": "v0.8.0", "github.com/sdboyer/deptestdos": "a0196baa11ea047dd65037287451d36b861b00ea" diff --git a/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.lock index 89372cc518..6782040d3a 100644 --- a/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/remove/unused/case1/testcase.json b/cmd/dep/testdata/harness_tests/remove/unused/case1/testcase.json index 23cc6142a5..09d58975e0 100644 --- a/cmd/dep/testdata/harness_tests/remove/unused/case1/testcase.json +++ b/cmd/dep/testdata/harness_tests/remove/unused/case1/testcase.json @@ -2,6 +2,7 @@ "commands": [ ["remove", "-unused"] ], + "error-expected": "", "vendor-final": [ "github.com/sdboyer/deptest", "github.com/sdboyer/deptestdos" diff --git a/cmd/dep/testdata/harness_tests/status/case1/dot/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/status/case1/dot/final/Gopkg.lock index 9b7e4cbf29..11ca7a566a 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/dot/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/status/case1/dot/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/status/case1/dot/testcase.json b/cmd/dep/testdata/harness_tests/status/case1/dot/testcase.json index 8295f9bed1..9634c3981a 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/dot/testcase.json +++ b/cmd/dep/testdata/harness_tests/status/case1/dot/testcase.json @@ -1,8 +1,9 @@ { "commands": [ ["ensure"], - ["status","-dot"] + ["status", "-dot"] ], + "error-expected": "", "vendor-final": [ "github.com/sdboyer/deptest", "github.com/sdboyer/deptestdos" diff --git a/cmd/dep/testdata/harness_tests/status/case1/json/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/status/case1/json/final/Gopkg.lock index 9b7e4cbf29..11ca7a566a 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/json/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/status/case1/json/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/status/case1/json/testcase.json b/cmd/dep/testdata/harness_tests/status/case1/json/testcase.json index 2444d2888c..9e1a0643b7 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/json/testcase.json +++ b/cmd/dep/testdata/harness_tests/status/case1/json/testcase.json @@ -1,8 +1,9 @@ { "commands": [ ["ensure"], - ["status","-json"] + ["status", "-json"] ], + "error-expected": "", "vendor-final": [ "github.com/sdboyer/deptest", "github.com/sdboyer/deptestdos" diff --git a/cmd/dep/testdata/harness_tests/status/case1/table/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/status/case1/table/final/Gopkg.lock index 9b7e4cbf29..11ca7a566a 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/table/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/status/case1/table/final/Gopkg.lock @@ -1,4 +1,8 @@ -memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + +[inputs] + analyzerName = "dep" + analyzerVersion = 1 + memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" [[projects]] name = "github.com/sdboyer/deptest" diff --git a/cmd/dep/testdata/harness_tests/status/case1/table/testcase.json b/cmd/dep/testdata/harness_tests/status/case1/table/testcase.json index 813db298bb..e1f1eadeeb 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/table/testcase.json +++ b/cmd/dep/testdata/harness_tests/status/case1/table/testcase.json @@ -3,6 +3,7 @@ ["ensure"], ["status"] ], + "error-expected": "", "vendor-final": [ "github.com/sdboyer/deptest", "github.com/sdboyer/deptestdos" diff --git a/internal/gps/result.go b/internal/gps/result.go index 3c79ffeac8..bea7cff13c 100644 --- a/internal/gps/result.go +++ b/internal/gps/result.go @@ -14,6 +14,10 @@ import ( // additional methods that report information about the solve run. type Solution interface { Lock + // The name of the ProjectAnalyzer used in generating this solution. + AnalyzerName() string + // The version of the ProjectAanalyzer used in generating this solution. + AnalyzerVersion() int Attempts() int } @@ -26,6 +30,12 @@ type solution struct { // The hash digest of the input opts hd []byte + + // The analyzer name + analyzerName string + + // The analyzer version + analyzerVersion int } // WriteDepTree takes a basedir and a Lock, and exports all the projects @@ -76,3 +86,11 @@ func (r solution) Attempts() int { func (r solution) InputHash() []byte { return r.hd } + +func (r solution) AnalyzerName() string { + return r.analyzerName +} + +func (r solution) AnalyzerVersion() int { + return r.analyzerVersion +} diff --git a/internal/gps/result_test.go b/internal/gps/result_test.go index ad2c235c94..b3a0ba949b 100644 --- a/internal/gps/result_test.go +++ b/internal/gps/result_test.go @@ -35,6 +35,7 @@ func init() { }, nil), }, } + basicResult.analyzerName, basicResult.analyzerVersion = (naiveAnalyzer{}).Info() // just in case something needs punishing, kubernetes is happy to oblige kub = atom{ diff --git a/internal/gps/solver.go b/internal/gps/solver.go index c2b8203ac7..fe9ea1afa5 100644 --- a/internal/gps/solver.go +++ b/internal/gps/solver.go @@ -358,7 +358,7 @@ func (s *solver) Solve() (Solution, error) { soln = solution{ att: s.attempts, } - + soln.analyzerName, soln.analyzerVersion = s.rd.an.Info() soln.hd = s.HashInputs() // Convert ProjectAtoms into LockedProjects diff --git a/lock.go b/lock.go index 3f0c02e92e..dda243cbb8 100644 --- a/lock.go +++ b/lock.go @@ -18,15 +18,27 @@ import ( const LockName = "Gopkg.lock" type Lock struct { - Memo []byte - P []gps.LockedProject + Inputs InputInfo + P []gps.LockedProject +} + +type InputInfo struct { + Memo []byte + AnalyzerName string + AnalyzerVersion int } type rawLock struct { - Memo string `toml:"memo"` + Inputs inputInfo `toml:"inputs"` Projects []rawLockedProject `toml:"projects"` } +type inputInfo struct { + Memo string `toml:"memo"` + AnalyzerName string `toml:"analyzerName"` + AnalyzerVersion int `toml:"analyzerVersion"` +} + type rawLockedProject struct { Name string `toml:"name"` Branch string `toml:"branch,omitempty"` @@ -58,11 +70,14 @@ func fromRawLock(raw rawLock) (*Lock, error) { P: make([]gps.LockedProject, len(raw.Projects)), } - l.Memo, err = hex.DecodeString(raw.Memo) + l.Inputs.Memo, err = hex.DecodeString(raw.Inputs.Memo) if err != nil { return nil, errors.Errorf("invalid hash digest in lock's memo field") } + l.Inputs.AnalyzerName = raw.Inputs.AnalyzerName + l.Inputs.AnalyzerVersion = raw.Inputs.AnalyzerVersion + for i, ld := range raw.Projects { r := gps.Revision(ld.Revision) @@ -84,11 +99,12 @@ func fromRawLock(raw rawLock) (*Lock, error) { } l.P[i] = gps.NewLockedProject(id, v, ld.Packages) } + return l, nil } func (l *Lock) InputHash() []byte { - return l.Memo + return l.Inputs.Memo } func (l *Lock) Projects() []gps.LockedProject { @@ -98,7 +114,11 @@ func (l *Lock) Projects() []gps.LockedProject { // toRaw converts the manifest into a representation suitable to write to the lock file func (l *Lock) toRaw() rawLock { raw := rawLock{ - Memo: hex.EncodeToString(l.Memo), + Inputs: inputInfo{ + Memo: hex.EncodeToString(l.Inputs.Memo), + AnalyzerName: l.Inputs.AnalyzerName, + AnalyzerVersion: l.Inputs.AnalyzerVersion, + }, Projects: make([]rawLockedProject, len(l.P)), } @@ -137,21 +157,19 @@ func (l *Lock) MarshalTOML() ([]byte, error) { // // As gps.Solution is a superset of gps.Lock, this can also be used to convert // solutions to dep's lock format. -func LockFromInterface(in gps.Lock) *Lock { - if in == nil { - return nil - } else if l, ok := in.(*Lock); ok { - return l - } - +func LockFromInterface(in gps.Solution) *Lock { h, p := in.InputHash(), in.Projects() l := &Lock{ - Memo: make([]byte, len(h)), - P: make([]gps.LockedProject, len(p)), + Inputs: InputInfo{ + Memo: make([]byte, len(h)), + AnalyzerName: in.AnalyzerName(), + AnalyzerVersion: in.AnalyzerVersion(), + }, + P: make([]gps.LockedProject, len(p)), } - copy(l.Memo, h) + copy(l.Inputs.Memo, h) copy(l.P, p) return l } diff --git a/lock_test.go b/lock_test.go index 2f035756b6..0389055c66 100644 --- a/lock_test.go +++ b/lock_test.go @@ -28,7 +28,9 @@ func TestReadLock(t *testing.T) { b, _ := hex.DecodeString("2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e") want := &Lock{ - Memo: b, + Inputs: InputInfo{ + Memo: b, + }, P: []gps.LockedProject{ gps.NewLockedProject( gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot("github.com/golang/dep/internal/gps")}, @@ -52,7 +54,9 @@ func TestReadLock(t *testing.T) { b, _ = hex.DecodeString("2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e") want = &Lock{ - Memo: b, + Inputs: InputInfo{ + Memo: b, + }, P: []gps.LockedProject{ gps.NewLockedProject( gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot("github.com/golang/dep/internal/gps")}, @@ -75,7 +79,9 @@ func TestWriteLock(t *testing.T) { want := h.GetTestFileString(golden) memo, _ := hex.DecodeString("2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e") l := &Lock{ - Memo: memo, + Inputs: InputInfo{ + Memo: memo, + }, P: []gps.LockedProject{ gps.NewLockedProject( gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot("github.com/golang/dep/internal/gps")}, @@ -104,7 +110,9 @@ func TestWriteLock(t *testing.T) { want = h.GetTestFileString(golden) memo, _ = hex.DecodeString("2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e") l = &Lock{ - Memo: memo, + Inputs: InputInfo{ + Memo: memo, + }, P: []gps.LockedProject{ gps.NewLockedProject( gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot("github.com/golang/dep/internal/gps")}, diff --git a/testdata/lock/error1.toml b/testdata/lock/error1.toml index 344ed1118b..676f01c2c1 100644 --- a/testdata/lock/error1.toml +++ b/testdata/lock/error1.toml @@ -1,3 +1,4 @@ +[inputs] memo = "000aaa2a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" [[projects]] diff --git a/testdata/lock/golden0.toml b/testdata/lock/golden0.toml index 35ffb6257c..039aa96af4 100644 --- a/testdata/lock/golden0.toml +++ b/testdata/lock/golden0.toml @@ -1,4 +1,8 @@ -memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" + +[inputs] + analyzerName = "" + analyzerVersion = 0 + memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" [[projects]] branch = "master" diff --git a/testdata/lock/golden1.toml b/testdata/lock/golden1.toml index dfa34d8859..cb7797dfab 100644 --- a/testdata/lock/golden1.toml +++ b/testdata/lock/golden1.toml @@ -1,4 +1,8 @@ -memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" + +[inputs] + analyzerName = "" + analyzerVersion = 0 + memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" [[projects]] name = "github.com/golang/dep/internal/gps" diff --git a/testdata/txn_writer/expected_diff_output.txt b/testdata/txn_writer/expected_diff_output.txt index bbfe78f82b..7fe4662ccd 100644 --- a/testdata/txn_writer/expected_diff_output.txt +++ b/testdata/txn_writer/expected_diff_output.txt @@ -1,5 +1,3 @@ -Memo: 595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c -> 2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e - Add: [[projects]] name = "github.com/sdboyer/deptest" diff --git a/testdata/txn_writer/expected_lock.toml b/testdata/txn_writer/expected_lock.toml index bda7ec14cb..cd30d511f4 100644 --- a/testdata/txn_writer/expected_lock.toml +++ b/testdata/txn_writer/expected_lock.toml @@ -1,4 +1,8 @@ -memo = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c" + +[inputs] + analyzerName = "" + analyzerVersion = 0 + memo = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c" [[projects]] name = "github.com/sdboyer/dep-test" diff --git a/txn_writer_test.go b/txn_writer_test.go index ecf0168f29..2b97a36551 100644 --- a/txn_writer_test.go +++ b/txn_writer_test.go @@ -261,7 +261,7 @@ func TestSafeWriter_ModifiedLock(t *testing.T) { originalLock := new(Lock) *originalLock = *pc.Project.Lock - originalLock.Memo = []byte{} // zero out the input hash to ensure non-equivalency + originalLock.Inputs.Memo = []byte{} // zero out the input hash to ensure non-equivalency sw, _ := NewSafeWriter(nil, originalLock, pc.Project.Lock, VendorOnChanged) // Verify prepared actions @@ -308,7 +308,7 @@ func TestSafeWriter_ModifiedLockSkipVendor(t *testing.T) { originalLock := new(Lock) *originalLock = *pc.Project.Lock - originalLock.Memo = []byte{} // zero out the input hash to ensure non-equivalency + originalLock.Inputs.Memo = []byte{} // zero out the input hash to ensure non-equivalency sw, _ := NewSafeWriter(nil, originalLock, pc.Project.Lock, VendorNever) // Verify prepared actions From 2081136c142832cce7c879611a602b1a8da2add2 Mon Sep 17 00:00:00 2001 From: sam boyer Date: Mon, 15 May 2017 23:12:06 -0400 Subject: [PATCH 07/19] s/LockFromInterface/LockFromSolution/ --- cmd/dep/ensure.go | 2 +- cmd/dep/init.go | 2 +- cmd/dep/remove.go | 2 +- lock.go | 8 ++------ 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cmd/dep/ensure.go b/cmd/dep/ensure.go index b10ec0f622..2e348cd7d4 100644 --- a/cmd/dep/ensure.go +++ b/cmd/dep/ensure.go @@ -162,7 +162,7 @@ func (cmd *ensureCommand) Run(ctx *dep.Ctx, args []string) error { writeV = dep.VendorAlways } - newLock := dep.LockFromInterface(solution) + newLock := dep.LockFromSolution(solution) sw, err := dep.NewSafeWriter(nil, p.Lock, newLock, writeV) if err != nil { return err diff --git a/cmd/dep/init.go b/cmd/dep/init.go index ac849c4d12..53133a79bf 100644 --- a/cmd/dep/init.go +++ b/cmd/dep/init.go @@ -178,7 +178,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error { handleAllTheFailuresOfTheWorld(err) return err } - l = dep.LockFromInterface(soln) + l = dep.LockFromSolution(soln) // Iterate through the new projects in solved lock and add them to manifest // if direct deps and log feedback for all the new projects. diff --git a/cmd/dep/remove.go b/cmd/dep/remove.go index e53e68e7da..90d81e50d6 100644 --- a/cmd/dep/remove.go +++ b/cmd/dep/remove.go @@ -176,7 +176,7 @@ func (cmd *removeCommand) Run(ctx *dep.Ctx, args []string) error { return err } - newLock := dep.LockFromInterface(soln) + newLock := dep.LockFromSolution(soln) sw, err := dep.NewSafeWriter(nil, p.Lock, newLock, dep.VendorOnChanged) if err != nil { diff --git a/lock.go b/lock.go index dda243cbb8..60d6cf4379 100644 --- a/lock.go +++ b/lock.go @@ -149,15 +149,11 @@ func (l *Lock) MarshalTOML() ([]byte, error) { return result, errors.Wrap(err, "Unable to marshal lock to TOML string") } -// LockFromInterface converts an arbitrary gps.Lock to dep's representation of a -// lock. If the input is already dep's *lock, the input is returned directly. +// LockFromSolution converts a gps.Solution to dep's representation of a lock. // // Data is defensively copied wherever necessary to ensure the resulting *lock // shares no memory with the original lock. -// -// As gps.Solution is a superset of gps.Lock, this can also be used to convert -// solutions to dep's lock format. -func LockFromInterface(in gps.Solution) *Lock { +func LockFromSolution(in gps.Solution) *Lock { h, p := in.InputHash(), in.Projects() l := &Lock{ From bf737b6eff4efae732a8a97226927b80ae910519 Mon Sep 17 00:00:00 2001 From: sam boyer Date: Mon, 22 May 2017 09:25:33 -0400 Subject: [PATCH 08/19] Expand Solver, Solution to report name/version --- internal/gps/result.go | 17 +++++++++++++++- internal/gps/solver.go | 46 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/internal/gps/result.go b/internal/gps/result.go index bea7cff13c..03948ff5bd 100644 --- a/internal/gps/result.go +++ b/internal/gps/result.go @@ -16,8 +16,12 @@ type Solution interface { Lock // The name of the ProjectAnalyzer used in generating this solution. AnalyzerName() string - // The version of the ProjectAanalyzer used in generating this solution. + // The version of the ProjectAnalyzer used in generating this solution. AnalyzerVersion() int + // The name of the Solver used in generating this solution. + SolverName() string + // The version of the Solver used in generating this solution. + SolverVersion() int Attempts() int } @@ -36,6 +40,9 @@ type solution struct { // The analyzer version analyzerVersion int + + // The solver used in producing this solution + solv Solver } // WriteDepTree takes a basedir and a Lock, and exports all the projects @@ -94,3 +101,11 @@ func (r solution) AnalyzerName() string { func (r solution) AnalyzerVersion() int { return r.analyzerVersion } + +func (r solution) SolverName() string { + return r.solv.Name() +} + +func (r solution) SolverVersion() int { + return r.solv.Version() +} diff --git a/internal/gps/solver.go b/internal/gps/solver.go index fe9ea1afa5..674524ef71 100644 --- a/internal/gps/solver.go +++ b/internal/gps/solver.go @@ -333,6 +333,49 @@ type Solver interface { // Solve initiates a solving run. It will either complete successfully with // a Solution, or fail with an informative error. Solve() (Solution, error) + + // Name returns a string identifying the particular solver backend. + // + // Different solvers likely have different invariants, and likely will not + // have identical possible result sets for any particular inputs; in some + // cases, they may even be disjoint. + Name() string + + // Version returns an int indicating the version of the solver of the given + // Name(). Implementations should change their reported version ONLY when + // the logic is changed in such a way that substantially changes the result + // set that is possible for a substantial subset of likely inputs. + // + // "Substantial" is an imprecise term, and it is used intentionally. There + // are no easy, general ways of subdividing constraint solving problems such + // that one can know, a priori, the full impact that subtle algorithmic + // changes will have on possible result sets. Consequently, we have to fall + // back on coarser, intuition-based reasoning as to whether a change is + // large enough that it is likely to be broadly user-visible. + // + // This is acceptable, because this value is not used programmatically by + // the solver in any way. Rather, it is intend for implementing tools to + // use as a coarse signal to users about compatibility between their tool's + // version and the current data, typically via persistence to a Lock. + // Changes to the version number reported should be weighed between + // confusing teams by having two members' tools continuously rolling back + // each others' chosen Solutions for no apparent reason, and annoying teams + // by changing the number for changes so remote that warnings about solver + // version mismatches become meaningless. + // + // Err on the side of caution. + // + // Chronology is the only implication of the ordering - that lower version + // numbers were published before higher numbers. + Version() int +} + +func (s *solver) Name() string { + return "gps-cdcl" +} + +func (s *solver) Version() int { + return 1 } // Solve attempts to find a dependency solution for the given project, as @@ -356,7 +399,8 @@ func (s *solver) Solve() (Solution, error) { var soln solution if err == nil { soln = solution{ - att: s.attempts, + att: s.attempts, + solv: s, } soln.analyzerName, soln.analyzerVersion = s.rd.an.Info() soln.hd = s.HashInputs() From 75ac56953320b6d68337f034c40fd0ef8fa71971 Mon Sep 17 00:00:00 2001 From: sam boyer Date: Mon, 22 May 2017 13:41:13 -0400 Subject: [PATCH 09/19] Incorporate solver name and version in Gopkg.lock --- cmd/dep/init.go | 2 +- cmd/dep/prune.go | 2 +- cmd/dep/status.go | 2 +- .../ensure/empty/case1/final/Gopkg.lock | 12 +++-- .../ensure/empty/case2/final/Gopkg.lock | 12 +++-- .../ensure/empty/case3/final/Gopkg.lock | 12 +++-- .../ensure/override/case1/final/Gopkg.lock | 12 +++-- .../ensure/pkg-errors/case1/final/Gopkg.lock | 10 ++-- .../ensure/update/case1/final/Gopkg.lock | 12 +++-- .../harness_tests/init/case1/final/Gopkg.lock | 12 +++-- .../harness_tests/init/case2/final/Gopkg.lock | 12 +++-- .../harness_tests/init/case3/final/Gopkg.lock | 12 +++-- .../init/skip-hidden/final/Gopkg.lock | 12 +++-- .../remove/force/case1/final/Gopkg.lock | 12 +++-- .../remove/specific/case1/final/Gopkg.lock | 12 +++-- .../remove/specific/case2/final/Gopkg.lock | 12 +++-- .../remove/unused/case1/final/Gopkg.lock | 12 +++-- .../status/case1/dot/final/Gopkg.lock | 12 +++-- .../status/case1/json/final/Gopkg.lock | 12 +++-- .../status/case1/table/final/Gopkg.lock | 12 +++-- lock.go | 48 +++++++++++-------- lock_test.go | 8 ++-- testdata/lock/error0.toml | 3 +- testdata/lock/error1.toml | 7 +-- testdata/lock/error2.toml | 6 ++- testdata/lock/golden0.toml | 12 +++-- testdata/lock/golden1.toml | 12 +++-- testdata/txn_writer/expected_lock.toml | 12 +++-- testdata/txn_writer/original_lock.toml | 3 +- testdata/txn_writer/updated_lock.toml | 3 +- txn_writer_test.go | 10 ++-- 31 files changed, 194 insertions(+), 138 deletions(-) diff --git a/cmd/dep/init.go b/cmd/dep/init.go index 53133a79bf..2df5361a92 100644 --- a/cmd/dep/init.go +++ b/cmd/dep/init.go @@ -211,7 +211,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error { return errors.Wrap(err, "prepare solver") } - l.Inputs.Memo = s.HashInputs() + l.SolveMeta.Memo = s.HashInputs() // Pass timestamp (yyyyMMddHHmmss format) as suffix to backup name. vendorbak, err := dep.BackupVendor(vpath, time.Now().Format("20060102150405")) diff --git a/cmd/dep/prune.go b/cmd/dep/prune.go index d2d0614ab7..fa2e6a7b91 100644 --- a/cmd/dep/prune.go +++ b/cmd/dep/prune.go @@ -68,7 +68,7 @@ func (cmd *pruneCommand) Run(ctx *dep.Ctx, args []string) error { return errors.Wrap(err, "could not set up solver for input hashing") } - if !bytes.Equal(s.HashInputs(), p.Lock.Inputs.Memo) { + if !bytes.Equal(s.HashInputs(), p.Lock.SolveMeta.Memo) { return fmt.Errorf("lock hash doesn't match") } diff --git a/cmd/dep/status.go b/cmd/dep/status.go index 68e7238da5..4b0858c4c5 100644 --- a/cmd/dep/status.go +++ b/cmd/dep/status.go @@ -277,7 +277,7 @@ func runStatusAll(loggers *dep.Loggers, out outputter, p *dep.Project, sm gps.So slp := p.Lock.Projects() sort.Sort(dep.SortedLockedProjects(slp)) - if bytes.Equal(s.HashInputs(), p.Lock.Inputs.Memo) { + if bytes.Equal(s.HashInputs(), p.Lock.SolveMeta.Memo) { // If these are equal, we're guaranteed that the lock is a transitively // complete picture of all deps. That eliminates the need for at least // some checks. diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.lock index 6cb2e0ddf8..4e2b2ddd19 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.lock @@ -1,11 +1,13 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf" version = "v1.0.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.lock index 87bee3fda5..a42ebeb645 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.lock @@ -1,11 +1,13 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "e7725ea56516a42a641aaaf5d48754258d9f3c59949cb8a0e8a21b1ab6e07179" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf" version = "v1.0.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "e7725ea56516a42a641aaaf5d48754258d9f3c59949cb8a0e8a21b1ab6e07179" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.lock index 2c4f895ae2..e0495bbd73 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.lock @@ -1,11 +1,13 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "e5c16e09ed6f0a1a2b3cf472c34b7fd50861dd070e81d5e623f72e8173f0c065" - [[projects]] branch = "master" name = "github.com/sdboyer/deptest" packages = ["."] revision = "3f4c3bea144e112a69bbe5d8d01c1b09a544253f" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "e5c16e09ed6f0a1a2b3cf472c34b7fd50861dd070e81d5e623f72e8173f0c065" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock index c3726a002b..5421bb412e 100644 --- a/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock @@ -1,11 +1,13 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "8bca9526e654e56e05d9075d1f33fa5b649bf6d58aa7d71ca39e7fbea8468e07" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf" version = "v1.0.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "8bca9526e654e56e05d9075d1f33fa5b649bf6d58aa7d71ca39e7fbea8468e07" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock index d5f19c45fe..8f31a52e8c 100644 --- a/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock @@ -1,5 +1,7 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7" +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.lock index b898609181..0b00a6c138 100644 --- a/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.lock @@ -1,9 +1,4 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] @@ -15,3 +10,10 @@ packages = ["."] revision = "5c607206be5decd28e6263ffffdcee067266015e" version = "v2.0.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock index 226b7b58a8..31f66ed271 100644 --- a/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock @@ -1,9 +1,4 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] @@ -14,3 +9,10 @@ name = "github.com/sdboyer/deptestdos" packages = ["."] revision = "a0196baa11ea047dd65037287451d36b861b00ea" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock index 6ca80abf05..8f0282efe5 100644 --- a/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock @@ -1,9 +1,4 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "b4fe6e8bceac924197838b6ea47989abbdd3a8d31035d20ee0a1dabc0994c368" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] @@ -15,3 +10,10 @@ packages = ["."] revision = "5c607206be5decd28e6263ffffdcee067266015e" version = "v2.0.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "b4fe6e8bceac924197838b6ea47989abbdd3a8d31035d20ee0a1dabc0994c368" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock index 7dd1c59f38..c8ae9a8044 100644 --- a/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock @@ -1,9 +1,4 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "af9a783a5430dabcaaf44683c09e2b729e1c0d61f13bfdf6677c4fd0b41387ca" - [[projects]] branch = "master" name = "github.com/sdboyer/deptest" @@ -14,3 +9,10 @@ name = "github.com/sdboyer/deptestdos" packages = ["."] revision = "a0196baa11ea047dd65037287451d36b861b00ea" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "af9a783a5430dabcaaf44683c09e2b729e1c0d61f13bfdf6677c4fd0b41387ca" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.lock index 6cb2e0ddf8..4e2b2ddd19 100644 --- a/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.lock @@ -1,11 +1,13 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf" version = "v1.0.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.lock index 6f19daa4bc..50eba069da 100644 --- a/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.lock @@ -1,9 +1,4 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] @@ -15,3 +10,10 @@ packages = ["."] revision = "5c607206be5decd28e6263ffffdcee067266015e" version = "v2.0.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock index 6782040d3a..7945f8f406 100644 --- a/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock @@ -1,9 +1,4 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] @@ -14,3 +9,10 @@ name = "github.com/sdboyer/deptestdos" packages = ["."] revision = "a0196baa11ea047dd65037287451d36b861b00ea" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock index c1b9827d32..81becf3f5e 100644 --- a/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock @@ -1,11 +1,13 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "38d8431865759ee3bf28fbdfc464f98ee8b56319394ec717df45e9969544cfca" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] revision = "ff2948a2ac8f538c4ecd55962e919d1e13e74baf" version = "v1.0.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "38d8431865759ee3bf28fbdfc464f98ee8b56319394ec717df45e9969544cfca" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.lock index 6782040d3a..7945f8f406 100644 --- a/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.lock @@ -1,9 +1,4 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] @@ -14,3 +9,10 @@ name = "github.com/sdboyer/deptestdos" packages = ["."] revision = "a0196baa11ea047dd65037287451d36b861b00ea" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/status/case1/dot/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/status/case1/dot/final/Gopkg.lock index 11ca7a566a..f2860246d6 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/dot/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/status/case1/dot/final/Gopkg.lock @@ -1,9 +1,4 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] @@ -15,3 +10,10 @@ packages = ["."] revision = "5c607206be5decd28e6263ffffdcee067266015e" version = "v2.0.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/status/case1/json/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/status/case1/json/final/Gopkg.lock index 11ca7a566a..f2860246d6 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/json/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/status/case1/json/final/Gopkg.lock @@ -1,9 +1,4 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] @@ -15,3 +10,10 @@ packages = ["."] revision = "5c607206be5decd28e6263ffffdcee067266015e" version = "v2.0.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/status/case1/table/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/status/case1/table/final/Gopkg.lock index 11ca7a566a..f2860246d6 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/table/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/status/case1/table/final/Gopkg.lock @@ -1,9 +1,4 @@ -[inputs] - analyzerName = "dep" - analyzerVersion = 1 - memo = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" - [[projects]] name = "github.com/sdboyer/deptest" packages = ["."] @@ -15,3 +10,10 @@ packages = ["."] revision = "5c607206be5decd28e6263ffffdcee067266015e" version = "v2.0.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-hash = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/lock.go b/lock.go index 60d6cf4379..0b2147b104 100644 --- a/lock.go +++ b/lock.go @@ -18,25 +18,29 @@ import ( const LockName = "Gopkg.lock" type Lock struct { - Inputs InputInfo - P []gps.LockedProject + SolveMeta SolveMeta + P []gps.LockedProject } -type InputInfo struct { +type SolveMeta struct { Memo []byte AnalyzerName string AnalyzerVersion int + SolverName string + SolverVersion int } type rawLock struct { - Inputs inputInfo `toml:"inputs"` - Projects []rawLockedProject `toml:"projects"` + SolveMeta solveMeta `toml:"solve-meta"` + Projects []rawLockedProject `toml:"projects"` } -type inputInfo struct { - Memo string `toml:"memo"` - AnalyzerName string `toml:"analyzerName"` - AnalyzerVersion int `toml:"analyzerVersion"` +type solveMeta struct { + Memo string `toml:"inputs-hash"` + AnalyzerName string `toml:"analyzer-name"` + AnalyzerVersion int `toml:"analyzer-version"` + SolverName string `toml:"solver-name"` + SolverVersion int `toml:"solver-version"` } type rawLockedProject struct { @@ -70,13 +74,15 @@ func fromRawLock(raw rawLock) (*Lock, error) { P: make([]gps.LockedProject, len(raw.Projects)), } - l.Inputs.Memo, err = hex.DecodeString(raw.Inputs.Memo) + l.SolveMeta.Memo, err = hex.DecodeString(raw.SolveMeta.Memo) if err != nil { return nil, errors.Errorf("invalid hash digest in lock's memo field") } - l.Inputs.AnalyzerName = raw.Inputs.AnalyzerName - l.Inputs.AnalyzerVersion = raw.Inputs.AnalyzerVersion + l.SolveMeta.AnalyzerName = raw.SolveMeta.AnalyzerName + l.SolveMeta.AnalyzerVersion = raw.SolveMeta.AnalyzerVersion + l.SolveMeta.SolverName = raw.SolveMeta.SolverName + l.SolveMeta.SolverVersion = raw.SolveMeta.SolverVersion for i, ld := range raw.Projects { r := gps.Revision(ld.Revision) @@ -104,7 +110,7 @@ func fromRawLock(raw rawLock) (*Lock, error) { } func (l *Lock) InputHash() []byte { - return l.Inputs.Memo + return l.SolveMeta.Memo } func (l *Lock) Projects() []gps.LockedProject { @@ -114,10 +120,12 @@ func (l *Lock) Projects() []gps.LockedProject { // toRaw converts the manifest into a representation suitable to write to the lock file func (l *Lock) toRaw() rawLock { raw := rawLock{ - Inputs: inputInfo{ - Memo: hex.EncodeToString(l.Inputs.Memo), - AnalyzerName: l.Inputs.AnalyzerName, - AnalyzerVersion: l.Inputs.AnalyzerVersion, + SolveMeta: solveMeta{ + Memo: hex.EncodeToString(l.SolveMeta.Memo), + AnalyzerName: l.SolveMeta.AnalyzerName, + AnalyzerVersion: l.SolveMeta.AnalyzerVersion, + SolverName: l.SolveMeta.SolverName, + SolverVersion: l.SolveMeta.SolverVersion, }, Projects: make([]rawLockedProject, len(l.P)), } @@ -157,15 +165,17 @@ func LockFromSolution(in gps.Solution) *Lock { h, p := in.InputHash(), in.Projects() l := &Lock{ - Inputs: InputInfo{ + SolveMeta: SolveMeta{ Memo: make([]byte, len(h)), AnalyzerName: in.AnalyzerName(), AnalyzerVersion: in.AnalyzerVersion(), + SolverName: in.SolverName(), + SolverVersion: in.SolverVersion(), }, P: make([]gps.LockedProject, len(p)), } - copy(l.Inputs.Memo, h) + copy(l.SolveMeta.Memo, h) copy(l.P, p) return l } diff --git a/lock_test.go b/lock_test.go index 0389055c66..3a80227ad2 100644 --- a/lock_test.go +++ b/lock_test.go @@ -28,7 +28,7 @@ func TestReadLock(t *testing.T) { b, _ := hex.DecodeString("2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e") want := &Lock{ - Inputs: InputInfo{ + SolveMeta: SolveMeta{ Memo: b, }, P: []gps.LockedProject{ @@ -54,7 +54,7 @@ func TestReadLock(t *testing.T) { b, _ = hex.DecodeString("2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e") want = &Lock{ - Inputs: InputInfo{ + SolveMeta: SolveMeta{ Memo: b, }, P: []gps.LockedProject{ @@ -79,7 +79,7 @@ func TestWriteLock(t *testing.T) { want := h.GetTestFileString(golden) memo, _ := hex.DecodeString("2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e") l := &Lock{ - Inputs: InputInfo{ + SolveMeta: SolveMeta{ Memo: memo, }, P: []gps.LockedProject{ @@ -110,7 +110,7 @@ func TestWriteLock(t *testing.T) { want = h.GetTestFileString(golden) memo, _ = hex.DecodeString("2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e") l = &Lock{ - Inputs: InputInfo{ + SolveMeta: SolveMeta{ Memo: memo, }, P: []gps.LockedProject{ diff --git a/testdata/lock/error0.toml b/testdata/lock/error0.toml index 8aca39428c..e004604fd4 100644 --- a/testdata/lock/error0.toml +++ b/testdata/lock/error0.toml @@ -1,4 +1,5 @@ -memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" +[solve-meta] +inputs-hash = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" [[projects]] name = "github.com/golang/dep/internal/gps" diff --git a/testdata/lock/error1.toml b/testdata/lock/error1.toml index 676f01c2c1..21b24cfd4f 100644 --- a/testdata/lock/error1.toml +++ b/testdata/lock/error1.toml @@ -1,8 +1,9 @@ -[inputs] -memo = "000aaa2a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" - [[projects]] name = "github.com/golang/dep/internal/gps" branch = "master" revision = "d05d5aca9f895d19e9265839bffeadd74a2d2ecb" packages = ["."] + +[solve-meta] + inputs-hash = "000aaa2a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" + diff --git a/testdata/lock/error2.toml b/testdata/lock/error2.toml index d88d3e437a..0b9d2c43d0 100644 --- a/testdata/lock/error2.toml +++ b/testdata/lock/error2.toml @@ -1,5 +1,7 @@ -memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" - [[projects]] name = "github.com/golang/dep/internal/gps" packages = ["."] + +[solve-meta] + inputs-hash = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" + diff --git a/testdata/lock/golden0.toml b/testdata/lock/golden0.toml index 039aa96af4..616f1f0a62 100644 --- a/testdata/lock/golden0.toml +++ b/testdata/lock/golden0.toml @@ -1,11 +1,13 @@ -[inputs] - analyzerName = "" - analyzerVersion = 0 - memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" - [[projects]] branch = "master" name = "github.com/golang/dep/internal/gps" packages = ["."] revision = "d05d5aca9f895d19e9265839bffeadd74a2d2ecb" + +[solve-meta] + analyzer-name = "" + analyzer-version = 0 + inputs-hash = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" + solver-name = "" + solver-version = 0 diff --git a/testdata/lock/golden1.toml b/testdata/lock/golden1.toml index cb7797dfab..4106cbc086 100644 --- a/testdata/lock/golden1.toml +++ b/testdata/lock/golden1.toml @@ -1,11 +1,13 @@ -[inputs] - analyzerName = "" - analyzerVersion = 0 - memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" - [[projects]] name = "github.com/golang/dep/internal/gps" packages = ["."] revision = "d05d5aca9f895d19e9265839bffeadd74a2d2ecb" version = "0.12.2" + +[solve-meta] + analyzer-name = "" + analyzer-version = 0 + inputs-hash = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" + solver-name = "" + solver-version = 0 diff --git a/testdata/txn_writer/expected_lock.toml b/testdata/txn_writer/expected_lock.toml index cd30d511f4..9a18be1360 100644 --- a/testdata/txn_writer/expected_lock.toml +++ b/testdata/txn_writer/expected_lock.toml @@ -1,11 +1,13 @@ -[inputs] - analyzerName = "" - analyzerVersion = 0 - memo = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c" - [[projects]] name = "github.com/sdboyer/dep-test" packages = ["."] revision = "2a3a211e171803acb82d1d5d42ceb53228f51751" version = "1.0.0" + +[solve-meta] + analyzer-name = "" + analyzer-version = 0 + inputs-hash = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c" + solver-name = "" + solver-version = 0 diff --git a/testdata/txn_writer/original_lock.toml b/testdata/txn_writer/original_lock.toml index 1a9384efa7..dd7467ad91 100644 --- a/testdata/txn_writer/original_lock.toml +++ b/testdata/txn_writer/original_lock.toml @@ -1,4 +1,5 @@ -memo = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c" +[solve-meta] + inputs-hash = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c" [[projects]] name = "github.com/foo/bar" diff --git a/testdata/txn_writer/updated_lock.toml b/testdata/txn_writer/updated_lock.toml index da44aa9a21..2f06b8f73f 100644 --- a/testdata/txn_writer/updated_lock.toml +++ b/testdata/txn_writer/updated_lock.toml @@ -1,4 +1,5 @@ -memo = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" +[solve-meta] + inputs-hash = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c" [[projects]] name = "github.com/foo/bar" diff --git a/txn_writer_test.go b/txn_writer_test.go index 2b97a36551..e68418fe93 100644 --- a/txn_writer_test.go +++ b/txn_writer_test.go @@ -261,18 +261,18 @@ func TestSafeWriter_ModifiedLock(t *testing.T) { originalLock := new(Lock) *originalLock = *pc.Project.Lock - originalLock.Inputs.Memo = []byte{} // zero out the input hash to ensure non-equivalency + originalLock.SolveMeta.Memo = []byte{} // zero out the input hash to ensure non-equivalency sw, _ := NewSafeWriter(nil, originalLock, pc.Project.Lock, VendorOnChanged) // Verify prepared actions if sw.HasManifest() { - t.Fatal("Did not expect the payload to contain the manifest") + t.Fatal("Did not expect the manifest to be written") } if !sw.HasLock() { - t.Fatal("Expected the payload to contain the lock") + t.Fatal("Expected that the writer should plan to write the lock") } if !sw.HasVendor() { - t.Fatal("Expected the payload to contain the vendor directory") + t.Fatal("Expected that the writer should plan to write the vendor directory") } // Write changes @@ -308,7 +308,7 @@ func TestSafeWriter_ModifiedLockSkipVendor(t *testing.T) { originalLock := new(Lock) *originalLock = *pc.Project.Lock - originalLock.Inputs.Memo = []byte{} // zero out the input hash to ensure non-equivalency + originalLock.SolveMeta.Memo = []byte{} // zero out the input hash to ensure non-equivalency sw, _ := NewSafeWriter(nil, originalLock, pc.Project.Lock, VendorNever) // Verify prepared actions From 0081879b447960c4d2325d4bc0bc7e13815bb981 Mon Sep 17 00:00:00 2001 From: sam boyer Date: Mon, 22 May 2017 22:35:18 -0400 Subject: [PATCH 10/19] Respond to review --- .../harness_tests/ensure/empty/case1/final/Gopkg.lock | 2 +- .../harness_tests/ensure/empty/case2/final/Gopkg.lock | 2 +- .../harness_tests/ensure/empty/case3/final/Gopkg.lock | 2 +- .../harness_tests/ensure/override/case1/final/Gopkg.lock | 2 +- .../harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock | 2 +- .../harness_tests/ensure/update/case1/final/Gopkg.lock | 2 +- cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock | 2 +- cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock | 2 +- cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock | 2 +- .../harness_tests/init/skip-hidden/final/Gopkg.lock | 2 +- .../harness_tests/remove/force/case1/final/Gopkg.lock | 2 +- .../harness_tests/remove/specific/case1/final/Gopkg.lock | 2 +- .../harness_tests/remove/specific/case2/final/Gopkg.lock | 2 +- .../harness_tests/remove/unused/case1/final/Gopkg.lock | 2 +- .../harness_tests/status/case1/dot/final/Gopkg.lock | 2 +- .../harness_tests/status/case1/json/final/Gopkg.lock | 2 +- .../harness_tests/status/case1/table/final/Gopkg.lock | 2 +- internal/gps/lock.go | 3 --- lock.go | 6 +++--- testdata/lock/error0.toml | 2 +- testdata/lock/error1.toml | 2 +- testdata/lock/error2.toml | 2 +- testdata/lock/golden0.toml | 2 +- testdata/lock/golden1.toml | 2 +- testdata/txn_writer/expected_diff_output.txt | 1 + testdata/txn_writer/expected_lock.toml | 2 +- testdata/txn_writer/original_lock.toml | 2 +- testdata/txn_writer/updated_lock.toml | 2 +- 28 files changed, 29 insertions(+), 31 deletions(-) diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.lock index 4e2b2ddd19..da1067fcb8 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.lock @@ -8,6 +8,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c" + inputs-digest = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.lock index a42ebeb645..cb9d384f10 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case2/final/Gopkg.lock @@ -8,6 +8,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "e7725ea56516a42a641aaaf5d48754258d9f3c59949cb8a0e8a21b1ab6e07179" + inputs-digest = "e7725ea56516a42a641aaaf5d48754258d9f3c59949cb8a0e8a21b1ab6e07179" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.lock index e0495bbd73..b21698e2a6 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case3/final/Gopkg.lock @@ -8,6 +8,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "e5c16e09ed6f0a1a2b3cf472c34b7fd50861dd070e81d5e623f72e8173f0c065" + inputs-digest = "e5c16e09ed6f0a1a2b3cf472c34b7fd50861dd070e81d5e623f72e8173f0c065" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock index 5421bb412e..e8a7a9206b 100644 --- a/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.lock @@ -8,6 +8,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "8bca9526e654e56e05d9075d1f33fa5b649bf6d58aa7d71ca39e7fbea8468e07" + inputs-digest = "8bca9526e654e56e05d9075d1f33fa5b649bf6d58aa7d71ca39e7fbea8468e07" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock index 8f31a52e8c..ac8c5ce2e7 100644 --- a/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/pkg-errors/case1/final/Gopkg.lock @@ -2,6 +2,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7" + inputs-digest = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.lock index 0b00a6c138..571fc14868 100644 --- a/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/ensure/update/case1/final/Gopkg.lock @@ -14,6 +14,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb" + inputs-digest = "1b381263a360eafafe3ef7f9be626672668d17250a3c9a8debd169d1b5e2eebb" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock index 31f66ed271..24d4e7fbb6 100644 --- a/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.lock @@ -13,6 +13,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + inputs-digest = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock index 8f0282efe5..0a80650995 100644 --- a/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.lock @@ -14,6 +14,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "b4fe6e8bceac924197838b6ea47989abbdd3a8d31035d20ee0a1dabc0994c368" + inputs-digest = "b4fe6e8bceac924197838b6ea47989abbdd3a8d31035d20ee0a1dabc0994c368" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock index c8ae9a8044..88db597d6b 100644 --- a/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.lock @@ -13,6 +13,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "af9a783a5430dabcaaf44683c09e2b729e1c0d61f13bfdf6677c4fd0b41387ca" + inputs-digest = "af9a783a5430dabcaaf44683c09e2b729e1c0d61f13bfdf6677c4fd0b41387ca" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.lock index 4e2b2ddd19..da1067fcb8 100644 --- a/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.lock @@ -8,6 +8,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c" + inputs-digest = "14b07b05e0f01051b03887ab2bf80b516bc5510ea92f75f76c894b1745d8850c" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.lock index 50eba069da..3fcf19c3dc 100644 --- a/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/remove/force/case1/final/Gopkg.lock @@ -14,6 +14,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + inputs-digest = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock index 7945f8f406..30f8660059 100644 --- a/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/remove/specific/case1/final/Gopkg.lock @@ -13,6 +13,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b" + inputs-digest = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock index 81becf3f5e..15b8aaed5d 100644 --- a/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/remove/specific/case2/final/Gopkg.lock @@ -8,6 +8,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "38d8431865759ee3bf28fbdfc464f98ee8b56319394ec717df45e9969544cfca" + inputs-digest = "38d8431865759ee3bf28fbdfc464f98ee8b56319394ec717df45e9969544cfca" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.lock index 7945f8f406..30f8660059 100644 --- a/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/remove/unused/case1/final/Gopkg.lock @@ -13,6 +13,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b" + inputs-digest = "d414dbf5fc668c1085effa68372d02e54b23d058cc66f9fd19ba094c6a946d9b" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/status/case1/dot/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/status/case1/dot/final/Gopkg.lock index f2860246d6..a237f4f080 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/dot/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/status/case1/dot/final/Gopkg.lock @@ -14,6 +14,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + inputs-digest = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/status/case1/json/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/status/case1/json/final/Gopkg.lock index f2860246d6..a237f4f080 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/json/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/status/case1/json/final/Gopkg.lock @@ -14,6 +14,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + inputs-digest = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/dep/testdata/harness_tests/status/case1/table/final/Gopkg.lock b/cmd/dep/testdata/harness_tests/status/case1/table/final/Gopkg.lock index f2860246d6..a237f4f080 100644 --- a/cmd/dep/testdata/harness_tests/status/case1/table/final/Gopkg.lock +++ b/cmd/dep/testdata/harness_tests/status/case1/table/final/Gopkg.lock @@ -14,6 +14,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-hash = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" + inputs-digest = "88d2718cda70cce45158f953d2c6ead79c1db38e67e9704aff72be8fddb096e7" solver-name = "gps-cdcl" solver-version = 1 diff --git a/internal/gps/lock.go b/internal/gps/lock.go index 2e7b787e72..af728dd18f 100644 --- a/internal/gps/lock.go +++ b/internal/gps/lock.go @@ -17,9 +17,6 @@ import ( // solution is all that would be necessary to constitute a lock file, though // tools can include whatever other information they want in their storage. type Lock interface { - // Indicates the version of the solver used to generate this lock data - //SolverVersion() string - // The hash of inputs to gps that resulted in this lock data InputHash() []byte diff --git a/lock.go b/lock.go index 0b2147b104..e3a3d181f5 100644 --- a/lock.go +++ b/lock.go @@ -36,7 +36,7 @@ type rawLock struct { } type solveMeta struct { - Memo string `toml:"inputs-hash"` + InputsDigest string `toml:"inputs-digest"` AnalyzerName string `toml:"analyzer-name"` AnalyzerVersion int `toml:"analyzer-version"` SolverName string `toml:"solver-name"` @@ -74,7 +74,7 @@ func fromRawLock(raw rawLock) (*Lock, error) { P: make([]gps.LockedProject, len(raw.Projects)), } - l.SolveMeta.Memo, err = hex.DecodeString(raw.SolveMeta.Memo) + l.SolveMeta.Memo, err = hex.DecodeString(raw.SolveMeta.InputsDigest) if err != nil { return nil, errors.Errorf("invalid hash digest in lock's memo field") } @@ -121,7 +121,7 @@ func (l *Lock) Projects() []gps.LockedProject { func (l *Lock) toRaw() rawLock { raw := rawLock{ SolveMeta: solveMeta{ - Memo: hex.EncodeToString(l.SolveMeta.Memo), + InputsDigest: hex.EncodeToString(l.SolveMeta.Memo), AnalyzerName: l.SolveMeta.AnalyzerName, AnalyzerVersion: l.SolveMeta.AnalyzerVersion, SolverName: l.SolveMeta.SolverName, diff --git a/testdata/lock/error0.toml b/testdata/lock/error0.toml index e004604fd4..141d5bc78a 100644 --- a/testdata/lock/error0.toml +++ b/testdata/lock/error0.toml @@ -1,5 +1,5 @@ [solve-meta] -inputs-hash = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" + inputs-digest = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" [[projects]] name = "github.com/golang/dep/internal/gps" diff --git a/testdata/lock/error1.toml b/testdata/lock/error1.toml index 21b24cfd4f..cf54d870cf 100644 --- a/testdata/lock/error1.toml +++ b/testdata/lock/error1.toml @@ -5,5 +5,5 @@ packages = ["."] [solve-meta] - inputs-hash = "000aaa2a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" + inputs-digest = "000aaa2a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" diff --git a/testdata/lock/error2.toml b/testdata/lock/error2.toml index 0b9d2c43d0..788fc8c7c8 100644 --- a/testdata/lock/error2.toml +++ b/testdata/lock/error2.toml @@ -3,5 +3,5 @@ packages = ["."] [solve-meta] - inputs-hash = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" + inputs-digest = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" diff --git a/testdata/lock/golden0.toml b/testdata/lock/golden0.toml index 616f1f0a62..2011593b48 100644 --- a/testdata/lock/golden0.toml +++ b/testdata/lock/golden0.toml @@ -8,6 +8,6 @@ [solve-meta] analyzer-name = "" analyzer-version = 0 - inputs-hash = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" + inputs-digest = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" solver-name = "" solver-version = 0 diff --git a/testdata/lock/golden1.toml b/testdata/lock/golden1.toml index 4106cbc086..fe2941c26f 100644 --- a/testdata/lock/golden1.toml +++ b/testdata/lock/golden1.toml @@ -8,6 +8,6 @@ [solve-meta] analyzer-name = "" analyzer-version = 0 - inputs-hash = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" + inputs-digest = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" solver-name = "" solver-version = 0 diff --git a/testdata/txn_writer/expected_diff_output.txt b/testdata/txn_writer/expected_diff_output.txt index 7fe4662ccd..ef4dd3e89c 100644 --- a/testdata/txn_writer/expected_diff_output.txt +++ b/testdata/txn_writer/expected_diff_output.txt @@ -1,3 +1,4 @@ +Memo: 595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c -> 2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e Add: [[projects]] name = "github.com/sdboyer/deptest" diff --git a/testdata/txn_writer/expected_lock.toml b/testdata/txn_writer/expected_lock.toml index 9a18be1360..e35ad1040a 100644 --- a/testdata/txn_writer/expected_lock.toml +++ b/testdata/txn_writer/expected_lock.toml @@ -8,6 +8,6 @@ [solve-meta] analyzer-name = "" analyzer-version = 0 - inputs-hash = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c" + inputs-digest = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c" solver-name = "" solver-version = 0 diff --git a/testdata/txn_writer/original_lock.toml b/testdata/txn_writer/original_lock.toml index dd7467ad91..c1d38a3173 100644 --- a/testdata/txn_writer/original_lock.toml +++ b/testdata/txn_writer/original_lock.toml @@ -1,5 +1,5 @@ [solve-meta] - inputs-hash = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c" + inputs-digest = "2252a285ab27944a4d7adcba8dbd03980f59ba652f12db39fa93b927c345593e" [[projects]] name = "github.com/foo/bar" diff --git a/testdata/txn_writer/updated_lock.toml b/testdata/txn_writer/updated_lock.toml index 2f06b8f73f..709d3e1844 100644 --- a/testdata/txn_writer/updated_lock.toml +++ b/testdata/txn_writer/updated_lock.toml @@ -1,5 +1,5 @@ [solve-meta] - inputs-hash = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c" + inputs-digest = "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c" [[projects]] name = "github.com/foo/bar" From 2e9aecce9d73e0143906599678d5c727812195f0 Mon Sep 17 00:00:00 2001 From: sam boyer Date: Tue, 23 May 2017 21:31:59 -0400 Subject: [PATCH 11/19] Update FAQ with new Gopkg.toml key names --- FAQ.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FAQ.md b/FAQ.md index a4d69a57ed..a72a1a62df 100644 --- a/FAQ.md +++ b/FAQ.md @@ -7,7 +7,7 @@ Please contribute to the FAQ! Found an explanation in an issue or pull request h Summarize the question and quote the reply, linking back to the original comment. * [What is the difference between Gopkg.toml (the "manifest") and Gopkg.lock (the "lock")?](#what-is-the-difference-between-gopkgtoml-the-manifest-and-gopkglock-the-lock) -* [When should I use dependencies, overrides or required in the manifest?](#when-should-i-use-dependencies-overrides-required-or-ignored-in-the-manifest) +* [When should I use `constraint`, `override` `required`, or `ignored` in the Gopkg.toml?](#when-should-i-use-constraint-override-required-or-ignored-in-gopkgtoml) * [What is a direct or transitive dependency?](#what-is-a-direct-or-transitive-dependency) * [Should I commit my vendor directory?](#should-i-commit-my-vendor-directory) * [Why is it `dep ensure` instead of `dep install`?](#why-is-it-dep-ensure-instead-of-dep-install) @@ -26,10 +26,10 @@ Summarize the question and quote the reply, linking back to the original comment > This flexibility is important because it allows us to provide easy commands (e.g. `dep ensure -update`) that can manage an update process for you, within the constraints you specify, AND because it allows your project, when imported by someone else, to collaboratively specify the constraints for your own dependencies. -[@sdboyer in #281](https://github.com/golang/dep/issues/281#issuecomment-284118314) -## When should I use dependencies, overrides, required, or ignored in the manifest? +## When should I use `constraint`, `override`, `required`, or `ignored` in `Gopkg.toml`? -* Use `dependencies` to constrain a [direct dependency](#what-is-a-direct-or-transitive-dependency) to a specific branch, version range, revision, or specify an alternate source such as a fork. -* Use `overrides` to constrain a [transitive dependency](#what-is-a-direct-or-transitive-dependency). See [How do I constrain a transitive dependency's version?](#how-do-i-constrain-a-transitive-dependencys-version) for more details on how overrides differ from dependencies. Overrides should be used cautiously, sparingly, and temporarily. +* Use `constraint` to constrain a [direct dependency](#what-is-a-direct-or-transitive-dependency) to a specific branch, version range, revision, or specify an alternate source such as a fork. +* Use `override` to constrain a [transitive dependency](#what-is-a-direct-or-transitive-dependency). See [How do I constrain a transitive dependency's version?](#how-do-i-constrain-a-transitive-dependencys-version) for more details on how overrides differ from dependencies. Overrides should be used cautiously, sparingly, and temporarily. * Use `required` to explicitly add a dependency that is not imported directly or transitively, for example a development package used for code generation. * Use `ignored` to ignore a package and any of that package's unique dependencies. From a75d6d2f3a3477df54ffb21294c6673032b8d4fc Mon Sep 17 00:00:00 2001 From: Carolyn Van Slyck Date: Wed, 24 May 2017 12:26:48 -0500 Subject: [PATCH 12/19] Support implied carets in gps --- internal/gps/constraint_test.go | 22 +++++++++++++++++ internal/gps/constraints.go | 44 +++++++++++++++++++++++++++++++++ internal/gps/version.go | 20 +++++++++++++++ internal/gps/version_unifier.go | 7 ++++++ 4 files changed, 93 insertions(+) diff --git a/internal/gps/constraint_test.go b/internal/gps/constraint_test.go index ab99063919..0aaf5f1709 100644 --- a/internal/gps/constraint_test.go +++ b/internal/gps/constraint_test.go @@ -674,6 +674,28 @@ func TestSemverConstraintOps(t *testing.T) { } } +func TestSemverConstraint_ImpliedCaret(t *testing.T) { + c, _ := NewSemverConstraintIC("1.0.0") + + wantS := "^1.0.0" + gotS := c.String() + if wantS != gotS { + t.Errorf("Expected string %s, got %s", wantS, gotS) + } + + wantI := "1.0.0" + gotI := c.ImpliedCaretString() + if wantI != gotI { + t.Errorf("Expected implied string %s, got %s", wantI, gotI) + } + + wantT := "svc-^1.0.0" + gotT := c.typedString() + if wantT != gotT { + t.Errorf("Expected type string %s, got %s", wantT, gotT) + } +} + // Test that certain types of cross-version comparisons work when they are // expressed as a version union (but that others don't). func TestVersionUnion(t *testing.T) { diff --git a/internal/gps/constraints.go b/internal/gps/constraints.go index eb89467e00..89762231b1 100644 --- a/internal/gps/constraints.go +++ b/internal/gps/constraints.go @@ -25,6 +25,14 @@ var ( type Constraint interface { fmt.Stringer + // ImpliedCaretString converts the Constraint to a string in the same manner + // as String(), but treats the empty operator as equivalent to ^, rather + // than =. + // + // In the same way that String() is the inverse of NewConstraint(), this + // method is the inverse of to NewSemverConstraintIC(). + ImpliedCaretString() string + // Matches indicates if the provided Version is allowed by the Constraint. Matches(Version) bool @@ -64,6 +72,24 @@ func NewSemverConstraint(body string) (Constraint, error) { return semverConstraint{c: c}, nil } +// NewSemverConstraintIC attempts to construct a semver Constraint object from the +// input string, defaulting to a caret, ^, when no constraint is specified. +// +// If the input string cannot be made into a valid semver Constraint, an error +// is returned. +func NewSemverConstraintIC(body string) (Constraint, error) { + c, err := semver.NewConstraintIC(body) + if err != nil { + return nil, err + } + // If we got a simple semver.Version, simplify by returning our + // corresponding type + if sv, ok := c.(semver.Version); ok { + return semVersion{sv: sv}, nil + } + return semverConstraint{c: c}, nil +} + type semverConstraint struct { c semver.Constraint } @@ -72,6 +98,16 @@ func (c semverConstraint) String() string { return c.c.String() } +// ImpliedCaretString converts the Constraint to a string in the same manner +// as String(), but treats the empty operator as equivalent to ^, rather +// than =. +// +// In the same way that String() is the inverse of NewConstraint(), this +// method is the inverse of to NewSemverConstraintIC(). +func (c semverConstraint) ImpliedCaretString() string { + return c.c.ImpliedCaretString() +} + func (c semverConstraint) typedString() string { return fmt.Sprintf("svc-%s", c.c.String()) } @@ -153,6 +189,10 @@ func (anyConstraint) String() string { return "*" } +func (anyConstraint) ImpliedCaretString() string { + return "*" +} + func (anyConstraint) typedString() string { return "any-*" } @@ -177,6 +217,10 @@ func (noneConstraint) String() string { return "" } +func (noneConstraint) ImpliedCaretString() string { + return "" +} + func (noneConstraint) typedString() string { return "none-" } diff --git a/internal/gps/version.go b/internal/gps/version.go index a75e38aad6..060c5b6971 100644 --- a/internal/gps/version.go +++ b/internal/gps/version.go @@ -119,6 +119,10 @@ func (r Revision) String() string { return string(r) } +func (r Revision) ImpliedCaretString() string { + return r.String() +} + func (r Revision) typedString() string { return "r-" + string(r) } @@ -195,6 +199,10 @@ func (v branchVersion) String() string { return string(v.name) } +func (v branchVersion) ImpliedCaretString() string { + return v.String() +} + func (v branchVersion) typedString() string { return fmt.Sprintf("b-%s", v.String()) } @@ -272,6 +280,10 @@ func (v plainVersion) String() string { return string(v) } +func (v plainVersion) ImpliedCaretString() string { + return v.String() +} + func (v plainVersion) typedString() string { return fmt.Sprintf("pv-%s", v.String()) } @@ -355,6 +367,10 @@ func (v semVersion) String() string { return str } +func (v semVersion) ImpliedCaretString() string { + return v.sv.ImpliedCaretString() +} + func (v semVersion) typedString() string { return fmt.Sprintf("sv-%s", v.String()) } @@ -439,6 +455,10 @@ func (v versionPair) String() string { return v.v.String() } +func (v versionPair) ImpliedCaretString() string { + return v.v.ImpliedCaretString() +} + func (v versionPair) typedString() string { return fmt.Sprintf("%s-%s", v.Unpair().typedString(), v.Underlying().typedString()) } diff --git a/internal/gps/version_unifier.go b/internal/gps/version_unifier.go index 7f9dc5d646..d9cfb2a9ef 100644 --- a/internal/gps/version_unifier.go +++ b/internal/gps/version_unifier.go @@ -184,6 +184,13 @@ func (vtu versionTypeUnion) String() string { panic("versionTypeUnion should never be turned into a string; it is solver internal-only") } +// This should generally not be called, but is required for the interface. If it +// is called, we have a bigger problem (the type has escaped the solver); thus, +// panic. +func (vtu versionTypeUnion) ImpliedCaretString() string { + panic("versionTypeUnion should never be turned into a string; it is solver internal-only") +} + func (vtu versionTypeUnion) typedString() string { panic("versionTypeUnion should never be turned into a string; it is solver internal-only") } From ecf43b900ce71cc6deddce9808c4c3a139c61d40 Mon Sep 17 00:00:00 2001 From: Carolyn Van Slyck Date: Wed, 24 May 2017 12:07:14 -0500 Subject: [PATCH 13/19] Always use implied carets in dep --- cmd/dep/ensure.go | 2 +- cmd/dep/ensure_test.go | 2 +- cmd/dep/init.go | 3 +-- cmd/dep/init_test.go | 2 +- manifest.go | 6 +++--- manifest_test.go | 4 ++-- testdata/manifest/golden.toml | 2 +- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/cmd/dep/ensure.go b/cmd/dep/ensure.go index 5a28839430..a5657edb29 100644 --- a/cmd/dep/ensure.go +++ b/cmd/dep/ensure.go @@ -329,7 +329,7 @@ func getProjectConstraint(arg string, sm gps.SourceManager) (gps.ProjectConstrai // semver, a revision, or as a fallback, a plain tag func deduceConstraint(s string) gps.Constraint { // always semver if we can - c, err := gps.NewSemverConstraint(s) + c, err := gps.NewSemverConstraintIC(s) if err == nil { return c } diff --git a/cmd/dep/ensure_test.go b/cmd/dep/ensure_test.go index 5d1a4ee232..5ccd3d840f 100644 --- a/cmd/dep/ensure_test.go +++ b/cmd/dep/ensure_test.go @@ -13,7 +13,7 @@ import ( func TestDeduceConstraint(t *testing.T) { t.Parallel() - sv, err := gps.NewSemverConstraint("v1.2.3") + sv, err := gps.NewSemverConstraintIC("v1.2.3") if err != nil { t.Fatal(err) } diff --git a/cmd/dep/init.go b/cmd/dep/init.go index 189ad039c0..43061623dc 100644 --- a/cmd/dep/init.go +++ b/cmd/dep/init.go @@ -319,8 +319,7 @@ func getProjectPropertiesFromVersion(v gps.Version) gps.ProjectProperties { case gps.IsBranch, gps.IsVersion: pp.Constraint = v case gps.IsSemver: - // TODO: remove "^" when https://github.com/golang/dep/issues/225 is ready. - c, err := gps.NewSemverConstraint("^" + v.String()) + c, err := gps.NewSemverConstraintIC(v.String()) if err != nil { panic(err) } diff --git a/cmd/dep/init_test.go b/cmd/dep/init_test.go index 37b6cfdf18..0c177de296 100644 --- a/cmd/dep/init_test.go +++ b/cmd/dep/init_test.go @@ -27,7 +27,7 @@ func TestContains(t *testing.T) { func TestGetProjectPropertiesFromVersion(t *testing.T) { t.Parallel() - wantSemver, _ := gps.NewSemverConstraint("^v1.0.0") + wantSemver, _ := gps.NewSemverConstraintIC("v1.0.0") cases := []struct { version, want gps.Constraint }{ diff --git a/manifest.go b/manifest.go index 557659bdc4..d92c72d397 100644 --- a/manifest.go +++ b/manifest.go @@ -162,7 +162,7 @@ func toProject(raw rawProject) (n gps.ProjectRoot, pp gps.ProjectProperties, err } // always semver if we can - pp.Constraint, err = gps.NewSemverConstraint(raw.Version) + pp.Constraint, err = gps.NewSemverConstraintIC(raw.Version) if err != nil { // but if not, fall back on plain versions pp.Constraint = gps.NewVersion(raw.Version) @@ -236,7 +236,7 @@ func toRawProject(name gps.ProjectRoot, project gps.ProjectProperties) rawProjec case gps.IsBranch: raw.Branch = v.String() case gps.IsSemver, gps.IsVersion: - raw.Version = v.String() + raw.Version = v.ImpliedCaretString() } return raw } @@ -248,7 +248,7 @@ func toRawProject(name gps.ProjectRoot, project gps.ProjectProperties) rawProjec // if !gps.IsAny(pp.Constraint) && !gps.IsNone(pp.Constraint) { if !gps.IsAny(project.Constraint) && project.Constraint != nil { // Has to be a semver range. - raw.Version = project.Constraint.String() + raw.Version = project.Constraint.ImpliedCaretString() } return raw } diff --git a/manifest_test.go b/manifest_test.go index 7ccb021008..8c2b68545a 100644 --- a/manifest_test.go +++ b/manifest_test.go @@ -25,7 +25,7 @@ func TestReadManifest(t *testing.T) { t.Fatalf("Should have read Manifest correctly, but got err %q", err) } - c, _ := gps.NewSemverConstraint(">=0.12.0, <1.0.0") + c, _ := gps.NewSemverConstraint("^0.12.0") want := Manifest{ Dependencies: map[gps.ProjectRoot]gps.ProjectProperties{ gps.ProjectRoot("github.com/golang/dep/internal/gps"): { @@ -61,7 +61,7 @@ func TestWriteManifest(t *testing.T) { golden := "manifest/golden.toml" want := h.GetTestFileString(golden) - c, _ := gps.NewSemverConstraint(">=0.12.0, <1.0.0") + c, _ := gps.NewSemverConstraint("^0.12.0") m := &Manifest{ Dependencies: map[gps.ProjectRoot]gps.ProjectProperties{ gps.ProjectRoot("github.com/golang/dep/internal/gps"): { diff --git a/testdata/manifest/golden.toml b/testdata/manifest/golden.toml index 98b7cd3e09..8bab2107ee 100644 --- a/testdata/manifest/golden.toml +++ b/testdata/manifest/golden.toml @@ -6,7 +6,7 @@ ignored = ["github.com/foo/bar"] [[dependencies]] name = "github.com/golang/dep/internal/gps" - version = ">=0.12.0, <1.0.0" + version = "0.12.0" [[overrides]] branch = "master" From 5285e629160a93476fc2fe421ed344b3991932e4 Mon Sep 17 00:00:00 2001 From: Carolyn Van Slyck Date: Wed, 24 May 2017 12:08:33 -0500 Subject: [PATCH 14/19] Preserve previous test behavior before implied caret --- .../testdata/harness_tests/ensure/override/case1/testcase.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/dep/testdata/harness_tests/ensure/override/case1/testcase.json b/cmd/dep/testdata/harness_tests/ensure/override/case1/testcase.json index efbbc392f7..4f1ce1d26b 100644 --- a/cmd/dep/testdata/harness_tests/ensure/override/case1/testcase.json +++ b/cmd/dep/testdata/harness_tests/ensure/override/case1/testcase.json @@ -1,7 +1,7 @@ { "commands": [ ["init"], - ["ensure", "-override", "github.com/sdboyer/deptest@1.0.0"] + ["ensure", "-override", "github.com/sdboyer/deptest@=1.0.0"] ], "error-expected": "", "vendor-final": [ From 8dcaab5ad14429c042596846b9d343e63730436f Mon Sep 17 00:00:00 2001 From: Carolyn Van Slyck Date: Tue, 23 May 2017 10:38:35 -0500 Subject: [PATCH 15/19] Fix deduceConstraint test to not rely upon the types being comparable --- cmd/dep/ensure_test.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/dep/ensure_test.go b/cmd/dep/ensure_test.go index 5ccd3d840f..927cac2492 100644 --- a/cmd/dep/ensure_test.go +++ b/cmd/dep/ensure_test.go @@ -5,6 +5,7 @@ package main import ( + "reflect" "testing" "github.com/golang/dep/internal/gps" @@ -31,10 +32,16 @@ func TestDeduceConstraint(t *testing.T) { "20120425195858-psty8c35ve2oej8t": gps.NewVersion("20120425195858-psty8c35ve2oej8t"), } - for str, expected := range constraints { - c := deduceConstraint(str) - if c != expected { - t.Fatalf("expected: %#v, got %#v for %s", expected, c, str) + for str, want := range constraints { + got := deduceConstraint(str) + + wantT := reflect.TypeOf(want) + gotT := reflect.TypeOf(got) + if wantT != gotT { + t.Errorf("expected type: %s, got %s, for input %s", wantT, gotT, str) + } + if got.String() != want.String() { + t.Errorf("expected value: %s, got %s for input %s", want, got, str) } } } From 16e350fdadd15d682490a458b9d7d183c4d3cccd Mon Sep 17 00:00:00 2001 From: Carolyn Van Slyck Date: Wed, 24 May 2017 15:14:11 -0500 Subject: [PATCH 16/19] Update testdata now that init omits carets in the manifest --- .../harness_tests/ensure/empty/case1/final/Gopkg.toml | 2 +- .../harness_tests/ensure/override/case1/final/Gopkg.toml | 2 +- cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.toml | 2 +- cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.toml | 4 ++-- .../testdata/harness_tests/init/skip-hidden/final/Gopkg.toml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.toml index 26987273ec..c34f3e6502 100644 --- a/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/empty/case1/final/Gopkg.toml @@ -53,4 +53,4 @@ [[dependencies]] name = "github.com/sdboyer/deptest" - version = "^1.0.0" + version = "1.0.0" diff --git a/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.toml index 26987273ec..c34f3e6502 100644 --- a/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/ensure/override/case1/final/Gopkg.toml @@ -53,4 +53,4 @@ [[dependencies]] name = "github.com/sdboyer/deptest" - version = "^1.0.0" + version = "1.0.0" diff --git a/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.toml index 6deaa21764..7cbbec2985 100644 --- a/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.toml @@ -1,4 +1,4 @@ [[dependencies]] name = "github.com/sdboyer/deptest" - version = "^0.8.0" + version = "0.8.0" diff --git a/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.toml index 55921055ae..91f9228623 100644 --- a/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.toml @@ -1,8 +1,8 @@ [[dependencies]] name = "github.com/sdboyer/deptest" - version = "^0.8.0" + version = "0.8.0" [[dependencies]] name = "github.com/sdboyer/deptestdos" - version = "^2.0.0" + version = "2.0.0" diff --git a/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.toml b/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.toml index d5f3e3c9d6..04a443daa3 100644 --- a/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.toml +++ b/cmd/dep/testdata/harness_tests/init/skip-hidden/final/Gopkg.toml @@ -1,4 +1,4 @@ [[dependencies]] name = "github.com/sdboyer/deptest" - version = "^1.0.0" + version = "1.0.0" From f1bd538bef607ba8cce0c98d4a83478b0403a2a1 Mon Sep 17 00:00:00 2001 From: sam boyer Date: Wed, 24 May 2017 22:12:04 -0400 Subject: [PATCH 17/19] Tidy up docs a bit --- internal/gps/constraints.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/gps/constraints.go b/internal/gps/constraints.go index 89762231b1..143c786c9a 100644 --- a/internal/gps/constraints.go +++ b/internal/gps/constraints.go @@ -30,7 +30,7 @@ type Constraint interface { // than =. // // In the same way that String() is the inverse of NewConstraint(), this - // method is the inverse of to NewSemverConstraintIC(). + // method is the inverse of NewSemverConstraintIC(). ImpliedCaretString() string // Matches indicates if the provided Version is allowed by the Constraint. @@ -73,7 +73,9 @@ func NewSemverConstraint(body string) (Constraint, error) { } // NewSemverConstraintIC attempts to construct a semver Constraint object from the -// input string, defaulting to a caret, ^, when no constraint is specified. +// input string, defaulting to a caret, ^, when no operator is specified. Put +// differently, ^ is the default operator for NewSemverConstraintIC, while = +// is the default operator for NewSemverConstraint. // // If the input string cannot be made into a valid semver Constraint, an error // is returned. @@ -103,7 +105,7 @@ func (c semverConstraint) String() string { // than =. // // In the same way that String() is the inverse of NewConstraint(), this -// method is the inverse of to NewSemverConstraintIC(). +// method is the inverse of NewSemverConstraintIC(). func (c semverConstraint) ImpliedCaretString() string { return c.c.ImpliedCaretString() } From 4df9c959a44fcfb37037b221965de4caf7800507 Mon Sep 17 00:00:00 2001 From: sam boyer Date: Wed, 24 May 2017 22:28:12 -0400 Subject: [PATCH 18/19] Update Gopkg.toml, Gopkg.lock to new forms --- Gopkg.lock | 10 +++++++++- Gopkg.toml | 6 ++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 92186ad471..d858806f0c 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -1,4 +1,5 @@ -memo = "932b7b1663f6eecccb1fada1d3670ae24cd8aa7c8b61e3b224edfefebe25954e" +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + [[projects]] branch = "2.x" @@ -41,3 +42,10 @@ memo = "932b7b1663f6eecccb1fada1d3670ae24cd8aa7c8b61e3b224edfefebe25954e" name = "github.com/sdboyer/constext" packages = ["."] revision = "836a144573533ea4da4e6929c235fd348aed1c80" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "04a69739bd134208497dbd584b8b6dbf9bbdc41337e9c1c81e24d9f1502d5153" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 94bb6dc2ee..b1d62c9671 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,12 +1,10 @@ -required = ["github.com/Masterminds/semver"] - [[constraint]] branch = "2.x" name = "github.com/Masterminds/semver" [[constraint]] name = "github.com/Masterminds/vcs" - version = "^1.11.0" + version = "1.11.0" [[constraint]] branch = "master" @@ -14,4 +12,4 @@ required = ["github.com/Masterminds/semver"] [[constraint]] name = "github.com/pkg/errors" - version = ">=0.8.0, <1.0.0" + version = "0.8.0" From ec6c4e8cdb855c37ca7eeb01fc78cf305c94d8b3 Mon Sep 17 00:00:00 2001 From: sam boyer Date: Wed, 24 May 2017 22:39:21 -0400 Subject: [PATCH 19/19] Fix out-of-date vendor --- vendor/github.com/pelletier/go-toml/marshal_test.go | 6 +++--- vendor/github.com/pelletier/go-toml/tomltree_create_test.go | 6 +++--- vendor/github.com/pelletier/go-toml/tomltree_write.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vendor/github.com/pelletier/go-toml/marshal_test.go b/vendor/github.com/pelletier/go-toml/marshal_test.go index e2db67fce5..891222e9b1 100644 --- a/vendor/github.com/pelletier/go-toml/marshal_test.go +++ b/vendor/github.com/pelletier/go-toml/marshal_test.go @@ -145,8 +145,8 @@ var docData = testDoc{ Second: &subdoc, }, SubDocList: []testSubDoc{ - {"List.First", 0}, - {"List.Second", 0}, + testSubDoc{"List.First", 0}, + testSubDoc{"List.Second", 0}, }, SubDocPtrs: []*testSubDoc{&subdoc}, } @@ -504,7 +504,7 @@ var strPtr = []*string{&str1, &str2} var strPtr2 = []*[]*string{&strPtr} var nestedTestData = nestedMarshalTestStruct{ - String: [][]string{{"Five", "Six"}, {"One", "Two"}}, + String: [][]string{[]string{"Five", "Six"}, []string{"One", "Two"}}, StringPtr: &strPtr2, } diff --git a/vendor/github.com/pelletier/go-toml/tomltree_create_test.go b/vendor/github.com/pelletier/go-toml/tomltree_create_test.go index 7e683fd1ba..6c1496835e 100644 --- a/vendor/github.com/pelletier/go-toml/tomltree_create_test.go +++ b/vendor/github.com/pelletier/go-toml/tomltree_create_test.go @@ -1,9 +1,9 @@ package toml import ( - "strconv" "testing" "time" + "strconv" ) type customString string @@ -60,7 +60,7 @@ func TestTomlTreeCreateToTree(t *testing.T) { }, "array": []string{"a", "b", "c"}, "array_uint": []uint{uint(1), uint(2)}, - "array_table": []map[string]interface{}{{"sub_map": 52}}, + "array_table": []map[string]interface{}{map[string]interface{}{"sub_map": 52}}, "array_times": []time.Time{time.Now(), time.Now()}, "map_times": map[string]time.Time{"now": time.Now()}, "custom_string_map_key": map[customString]interface{}{customString("custom"): "custom"}, @@ -97,7 +97,7 @@ func TestTomlTreeCreateToTreeInvalidArrayMemberType(t *testing.T) { } func TestTomlTreeCreateToTreeInvalidTableGroupType(t *testing.T) { - _, err := TreeFromMap(map[string]interface{}{"foo": []map[string]interface{}{{"hello": t}}}) + _, err := TreeFromMap(map[string]interface{}{"foo": []map[string]interface{}{map[string]interface{}{"hello": t}}}) expected := "cannot convert type *testing.T to TomlTree" if err.Error() != expected { t.Fatalf("expected error %s, got %s", expected, err.Error()) diff --git a/vendor/github.com/pelletier/go-toml/tomltree_write.go b/vendor/github.com/pelletier/go-toml/tomltree_write.go index 4df87eba0f..6a7fa17458 100644 --- a/vendor/github.com/pelletier/go-toml/tomltree_write.go +++ b/vendor/github.com/pelletier/go-toml/tomltree_write.go @@ -4,11 +4,11 @@ import ( "bytes" "fmt" "io" - "reflect" "sort" "strconv" "strings" "time" + "reflect" ) // encodes a string to a TOML-compliant string value