feat: change interface from ID()/Release() to Distro() with both
This commit is contained in:
@ -43,14 +43,6 @@ type Debian struct {
|
||||
container string
|
||||
}
|
||||
|
||||
func (d Debian) ID() distro.ID {
|
||||
return distro.Debian
|
||||
}
|
||||
|
||||
func (d Debian) Release() string {
|
||||
return d.release.String()
|
||||
}
|
||||
|
||||
func (d Debian) Equal(dd distro.Distro) bool {
|
||||
if dd.ID != distro.Debian {
|
||||
return false
|
||||
@ -59,6 +51,10 @@ func (d Debian) Equal(dd distro.Distro) bool {
|
||||
return ReleaseFromString(dd.Release) == d.release
|
||||
}
|
||||
|
||||
func (d Debian) Distro() distro.Distro {
|
||||
return distro.Distro{distro.Debian, d.release.String()}
|
||||
}
|
||||
|
||||
func (d Debian) Packages() (packages []string, err error) {
|
||||
c, err := container.New(d.container)
|
||||
if err != nil {
|
||||
|
@ -48,8 +48,6 @@ func TestDebian(t *testing.T) {
|
||||
|
||||
u := Debian{release: Wheezy, container: "out_of_tree_debian_7"}
|
||||
|
||||
assert.Equal(u.ID(), distro.Debian)
|
||||
assert.Equal(u.Release(), "wheezy")
|
||||
|
||||
assert.True(u.Equal(distro.Distro{Release: "wheezy", ID: distro.Debian}))
|
||||
|
||||
|
Reference in New Issue
Block a user