Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Rename [[dependencies]] to [[constraint]] #538

Merged
merged 5 commits into from
May 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 2 additions & 2 deletions cmd/dep/ensure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/dep/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/dep/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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)
}

Expand All @@ -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))
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/dep/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
#
Expand All @@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Override" should probably be "Overrides" here to be grammatically correct and consistent with line 15.

Or, this sentence could be "Override has ..." and line 15 can be changed to "Constraint is a rule ..."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the former is preferred, primarily for consistency.

## [[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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Override is a sledgehammer. Use it only as a last resort."

or

"Overrides are a sledgehammer. Use them only as a last resort."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latter, please 😄

# [[override]]
## Required: the root import path of the project being constrained.
# name = "github.com/user/project"
#
Expand All @@ -51,6 +52,6 @@



[[dependencies]]
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "^1.0.0"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[dependencies]]
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "~0.8.0"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[dependencies]]
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "~0.8.0"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ignored = ["github.com/sdboyer/deptestdos"]

[[dependencies]]
[[constraint]]
branch = "master"
name = "github.com/sdboyer/deptest"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ignored = ["github.com/sdboyer/deptestdos"]

[[dependencies]]
[[constraint]]
branch = "master"
name = "github.com/sdboyer/deptest"
Original file line number Diff line number Diff line change
Expand Up @@ -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"
#
Expand All @@ -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"
#
Expand All @@ -51,6 +52,6 @@



[[dependencies]]
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "^1.0.0"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[dependencies]]
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "~0.8.0"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[dependencies]]
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "~0.8.0"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[dependencies]]
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "~0.8.0"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[dependencies]]
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "~0.8.0"
4 changes: 2 additions & 2 deletions cmd/dep/testdata/harness_tests/init/case1/final/Gopkg.toml
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 2 additions & 2 deletions cmd/dep/testdata/harness_tests/init/case2/final/Gopkg.toml
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 2 additions & 2 deletions cmd/dep/testdata/harness_tests/init/case3/final/Gopkg.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[[dependencies]]
[[constraint]]
branch = "master"
name = "github.com/sdboyer/deptest"

[[dependencies]]
[[constraint]]
name = "github.com/sdboyer/deptestdos"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

[[dependencies]]
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "^1.0.0"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[dependencies]]
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "^0.8.0"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[dependencies]]
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "^0.8.0"
Loading