add FindOsUrl function

This commit is contained in:
denver 2023-02-03 01:53:20 +03:00
parent 4238de8568
commit ab2afeb177

View File

@ -19,8 +19,17 @@ type JavaMetas struct {
JavaVersions []JavaMeta `json:"javaVersions"` JavaVersions []JavaMeta `json:"javaVersions"`
} }
func (jm JavaMetas) GetOsURL() (string, error) { func (jm JavaMetas) FindOsURL(MajorVersion string) (SpecificJavaVersion, error) {
for _, v := range jm.JavaVersions {
if MajorVersion == v.Version.Major {
jv, err := v.getOsJava()
if err != nil {
continue
}
return jv, nil
}
}
return SpecificJavaVersion{}, errors.New("cant find os url")
} }
type JavaMeta struct { type JavaMeta struct {