#8 change update mod.

This commit is contained in:
Gorbunov Kirill Andreevich
2024-03-16 02:25:18 +03:00
parent 825d778582
commit 3a60ffbf91
4 changed files with 52 additions and 42 deletions

View File

@@ -163,6 +163,7 @@ func Query(modpath string, cached bool) (*Module, bool, error) {
// cached sets the Disable-Module-Fetch: true header
func Latest(modpath string, cached bool) (*Module, error) {
latest, ok, err := Query(modpath, cached)
fmt.Println("latest: ", latest)
if err != nil {
return nil, err
}
@@ -275,7 +276,14 @@ func Updates(opt UpdateOptions) {
ch <- Update{Module: m, Err: err}
return nil
}
v := mod.MaxVersion("", opt.Pre)
prefix, ok := ModMajor(mod.Path)
var v string
switch ok {
case true:
v = mod.MaxVersion(prefix, opt.Pre)
default:
v = mod.MaxVersion("", opt.Pre)
}
if IsNewerVersion(m.Version, v, opt.Major) {
ch <- Update{Module: m, Version: v}
}