fix FindVersion()

This commit is contained in:
Jeff Carr 2025-03-23 11:43:55 -05:00
parent 98ba8076ae
commit 1c479b61f6
1 changed files with 13 additions and 1 deletions

14
wit.go
View File

@ -32,7 +32,19 @@ func (m *Machine) FindInstalledByName(name string) *Package {
// looks to see if any package matches a name and version
// if version == "", return the first name found
func (m *Machine) FindVersion(name string, version string) *Package {
func (m *Machine) FindVersion(name string) string {
// first check all installed versions
for p := range m.Packages.IterByName() {
if name == p.Name {
return p.Version
}
}
return ""
}
// looks to see if any package matches a name and version
// if version == "", return the first name found
func (m *Machine) FindByVersion(name string, version string) *Package {
// first check all installed versions
for p := range m.Packages.IterByName() {
if name == p.Name {