feat: change interface from ID()/Release() to Distro() with both
This commit is contained in:
@ -29,18 +29,14 @@ type CentOS struct {
|
||||
container string
|
||||
}
|
||||
|
||||
func (centos CentOS) ID() distro.ID {
|
||||
return distro.CentOS
|
||||
}
|
||||
|
||||
func (centos CentOS) Release() string {
|
||||
return centos.release
|
||||
}
|
||||
|
||||
func (centos CentOS) Equal(d distro.Distro) bool {
|
||||
return centos.release == d.Release && distro.CentOS == d.ID
|
||||
}
|
||||
|
||||
func (centos CentOS) Distro() distro.Distro {
|
||||
return distro.Distro{ID: distro.CentOS, Release: centos.release}
|
||||
}
|
||||
|
||||
func (centos CentOS) Packages() (pkgs []string, err error) {
|
||||
c, err := container.New(centos.container)
|
||||
if err != nil {
|
||||
|
@ -13,8 +13,6 @@ func TestCentOS(t *testing.T) {
|
||||
|
||||
u := CentOS{release: "7", container: "out_of_tree_centos_7"}
|
||||
|
||||
assert.Equal(u.ID(), distro.CentOS)
|
||||
assert.Equal(u.Release(), "7")
|
||||
|
||||
assert.True(u.Equal(distro.Distro{Release: "7", ID: distro.CentOS}))
|
||||
|
||||
|
Reference in New Issue
Block a user