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

Commit

Permalink
Merge pull request #711 from mikijov/better-manifest-errors
Browse files Browse the repository at this point in the history
Added check for multiple overrides in manifest files.
  • Loading branch information
carolynvs committed Jun 17, 2017
2 parents a42708e + 319d04e commit dfc77a0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ func fromRawManifest(raw rawManifest) (*Manifest, error) {
if err != nil {
return nil, err
}
if _, exists := m.Ovr[name]; exists {
return nil, errors.Errorf("multiple overrides specified for %s, can only specify one", name)
}
m.Ovr[name] = prj
}

Expand Down
1 change: 1 addition & 0 deletions manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func TestReadManifestErrors(t *testing.T) {
}{
{"multiple constraints", "manifest/error1.toml"},
{"multiple dependencies", "manifest/error2.toml"},
{"multiple overrides", "manifest/error3.toml"},
}

for _, tst := range tests {
Expand Down
9 changes: 9 additions & 0 deletions testdata/manifest/error3.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ignored = ["github.com/foo/bar"]

[[override]]
name = "github.com/golang/dep"
branch = "master"

[[override]]
name = "github.com/golang/dep"
branch = "master"

0 comments on commit dfc77a0

Please sign in to comment.