Changing "Ignores" to "Ignored"

This commit is contained in:
tro3 2017-04-15 20:22:59 -07:00
Родитель 7367dc9412
Коммит 56e7772f23
6 изменённых файлов: 16 добавлений и 15 удалений

Просмотреть файл

@ -9,6 +9,7 @@ import (
"sort"
"bytes"
"github.com/pelletier/go-toml"
"github.com/pkg/errors"
"github.com/sdboyer/gps"
@ -19,14 +20,14 @@ const ManifestName = "Gopkg.toml"
type Manifest struct {
Dependencies gps.ProjectConstraints
Ovr gps.ProjectConstraints
Ignores []string
Ignored []string
Required []string
}
type rawManifest struct {
Dependencies []rawProject `toml:"dependencies,omitempty"`
Overrides []rawProject `toml:"overrides,omitempty"`
Ignores []string `toml:"ignores,omitempty"`
Ignored []string `toml:"ignored,omitempty"`
Required []string `toml:"required,omitempty"`
}
@ -58,7 +59,7 @@ func fromRawManifest(raw rawManifest) (*Manifest, error) {
m := &Manifest{
Dependencies: make(gps.ProjectConstraints, len(raw.Dependencies)),
Ovr: make(gps.ProjectConstraints, len(raw.Overrides)),
Ignores: raw.Ignores,
Ignored: raw.Ignored,
Required: raw.Required,
}
@ -123,7 +124,7 @@ func (m *Manifest) toRaw() rawManifest {
raw := rawManifest{
Dependencies: make([]rawProject, 0, len(m.Dependencies)),
Overrides: make([]rawProject, 0, len(m.Ovr)),
Ignores: m.Ignores,
Ignored: m.Ignored,
Required: m.Required,
}
for n, prj := range m.Dependencies {
@ -206,12 +207,12 @@ func (m *Manifest) Overrides() gps.ProjectConstraints {
}
func (m *Manifest) IgnoredPackages() map[string]bool {
if len(m.Ignores) == 0 {
if len(m.Ignored) == 0 {
return nil
}
mp := make(map[string]bool, len(m.Ignores))
for _, i := range m.Ignores {
mp := make(map[string]bool, len(m.Ignored))
for _, i := range m.Ignored {
mp[i] = true
}

Просмотреть файл

@ -40,7 +40,7 @@ func TestReadManifest(t *testing.T) {
Constraint: gps.NewBranch("master"),
},
},
Ignores: []string{"github.com/foo/bar"},
Ignored: []string{"github.com/foo/bar"},
}
if !reflect.DeepEqual(got.Dependencies, want.Dependencies) {
@ -49,8 +49,8 @@ func TestReadManifest(t *testing.T) {
if !reflect.DeepEqual(got.Ovr, want.Ovr) {
t.Error("Valid manifest's overrides did not parse as expected")
}
if !reflect.DeepEqual(got.Ignores, want.Ignores) {
t.Error("Valid manifest's ignores did not parse as expected")
if !reflect.DeepEqual(got.Ignored, want.Ignored) {
t.Error("Valid manifest's ignored did not parse as expected")
}
}
@ -76,7 +76,7 @@ func TestWriteManifest(t *testing.T) {
Constraint: gps.NewBranch("master"),
},
},
Ignores: []string{"github.com/foo/bar"},
Ignored: []string{"github.com/foo/bar"},
}
got, err := m.MarshalTOML()

Просмотреть файл

@ -65,7 +65,7 @@ func TestProjectMakeParams(t *testing.T) {
p := Project{
AbsRoot: "someroot",
ImportRoot: gps.ProjectRoot("Some project root"),
Manifest: &Manifest{Ignores: []string{"ignoring this"}},
Manifest: &Manifest{Ignored: []string{"ignoring this"}},
Lock: &Lock{},
}

2
testdata/manifest/error1.toml поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
ignores = ["github.com/foo/bar"]
ignored = ["github.com/foo/bar"]
[[dependencies]]
name = "github.com/sdboyer/gps"

2
testdata/manifest/error2.toml поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
ignores = ["github.com/foo/bar"]
ignored = ["github.com/foo/bar"]
[[dependencies]]
name = "github.com/sdboyer/gps"

2
testdata/manifest/golden.toml поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
ignores = ["github.com/foo/bar"]
ignored = ["github.com/foo/bar"]
[[dependencies]]
name = "github.com/babble/brook"