#8 new flag UpMajor.
This commit is contained in:
@@ -250,7 +250,8 @@ type UpdateOptions struct {
|
||||
Modules []module.Version
|
||||
Pre bool
|
||||
Cached bool
|
||||
Major bool
|
||||
Major bool // Major true compare only major
|
||||
UpMajor bool // UpMajor module up with major
|
||||
}
|
||||
|
||||
// Updates finds updates for a set of specified modules.
|
||||
@@ -276,13 +277,13 @@ func Updates(opt UpdateOptions) {
|
||||
ch <- Update{Module: m, Err: err}
|
||||
return nil
|
||||
}
|
||||
prefix, ok := ModMajor(mod.Path)
|
||||
major := semver.Major(m.Version)
|
||||
var v string
|
||||
switch ok {
|
||||
switch opt.UpMajor {
|
||||
case true:
|
||||
v = mod.MaxVersion(prefix, opt.Pre)
|
||||
default:
|
||||
v = mod.MaxVersion("", opt.Pre)
|
||||
case false:
|
||||
v = mod.MaxVersion(major, opt.Pre)
|
||||
}
|
||||
if IsNewerVersion(m.Version, v, opt.Major) {
|
||||
ch <- Update{Module: m, Version: v}
|
||||
|
Reference in New Issue
Block a user