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