From ff254a8fad4a3efaa0f9ae8ac4e3a655c1bf094a Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Tue, 9 May 2017 14:49:25 -0300 Subject: [PATCH 1/5] 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 2/5] 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 3/5] 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 4/5] 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 5/5] 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" #