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/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/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..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,9 +12,10 @@ ## or in a dependency. # ignored = ["github.com/user/project/badpkg"] -## Dependencies 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. -# [[dependencies]] +# [[constraint]] ## Required: the root import path of the project being constrained. # name = "github.com/user/project" # @@ -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 [[dependencies]], but supercede all -## [[dependencies]] declarations from all projects. Only the current project's -## [[overrides]] are applied. +## Override have the same structure as [[constraint]], but supercede all +## [[constraint]] declarations from all projects. Only the current project's +## [[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" # @@ -51,6 +52,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..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,9 +12,10 @@ ## or in a dependency. # ignored = ["github.com/user/project/badpkg"] -## Dependencies 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. -# [[dependencies]] +# [[constraint]] ## Required: the root import path of the project being constrained. # name = "github.com/user/project" # @@ -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 [[dependencies]], but supercede all -## [[dependencies]] declarations from all projects. Only the current project's -## [[overrides]] are applied. +## Override have the same structure as [[constraint]], but supercede all +## [[constraint]] declarations from all projects. Only the current project's +## [[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" # @@ -51,6 +52,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" 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/manifest.go b/manifest.go index 621edf1a6a..ebde1a2078 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:"override,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, }, 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..4f76844011 100644 --- a/testdata/manifest/error1.toml +++ b/testdata/manifest/error1.toml @@ -1,13 +1,13 @@ ignored = ["github.com/foo/bar"] -[[dependencies]] +[[constraint]] name = "github.com/golang/dep/gps" branch = "master" revision = "d05d5aca9f895d19e9265839bffeadd74a2d2ecb" 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/error2.toml b/testdata/manifest/error2.toml index 9a0f052f06..2965640a96 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..a947b8a987 100644 --- a/testdata/manifest/golden.toml +++ b/testdata/manifest/golden.toml @@ -1,14 +1,14 @@ 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" -[[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 e0e080df27..440555b00f 100644 --- a/testdata/txn_writer/expected_manifest.toml +++ b/testdata/txn_writer/expected_manifest.toml @@ -12,9 +12,10 @@ ## or in a dependency. # ignored = ["github.com/user/project/badpkg"] -## Dependencies 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. -# [[dependencies]] +# [[constraint]] ## Required: the root import path of the project being constrained. # name = "github.com/user/project" # @@ -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 [[dependencies]], but supercede all -## [[dependencies]] declarations from all projects. Only the current project's -## [[overrides]] are applied. +## Override have the same structure as [[constraint]], but supercede all +## [[constraint]] declarations from all projects. Only the current project's +## [[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" # @@ -51,6 +52,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..f7ef11b384 100644 --- a/txn_writer.go +++ b/txn_writer.go @@ -36,9 +36,10 @@ const exampleTOML = ` ## or in a dependency. # ignored = ["github.com/user/project/badpkg"] -## Dependencies 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. -# [[dependencies]] +# [[constraint]] ## Required: the root import path of the project being constrained. # name = "github.com/user/project" # @@ -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 [[dependencies]], but supercede all -## [[dependencies]] declarations from all projects. Only the current project's -## [[overrides]] are applied. +## Override have the same structure as [[constraint]], but supercede all +## [[constraint]] declarations from all projects. Only the current project's +## [[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" #