@@ -40,7 +40,7 @@ type Platform struct {
40
40
Architecture string // The name of the architecture of this package.
41
41
Releases map [semver.NormalizedString ]* PlatformRelease // The Releases of this platform, labeled by version.
42
42
Package * Package `json:"-"`
43
- ManuallyInstalled bool // true if the Platform has been installed without the CLI
43
+ ManuallyInstalled bool // true if the Platform exists due to a manually installed release
44
44
Deprecated bool // true if the latest PlatformRelease of this Platform has been deprecated
45
45
Indexed bool // true if the Platform has been indexed from additional-urls
46
46
Latest * semver.Version `json:"-"`
@@ -238,10 +238,10 @@ func (d *MonitorDependency) String() string {
238
238
// GetOrCreateRelease returns the specified release corresponding the provided version,
239
239
// or creates a new one if not found.
240
240
func (platform * Platform ) GetOrCreateRelease (version * semver.Version ) * PlatformRelease {
241
- var tag semver.NormalizedString
242
- if version != nil {
243
- tag = version .NormalizedString ()
241
+ if version == nil {
242
+ version = semver .MustParse ("" )
244
243
}
244
+ tag := version .NormalizedString ()
245
245
if release , ok := platform .Releases [tag ]; ok {
246
246
return release
247
247
}
@@ -257,6 +257,13 @@ func (platform *Platform) GetOrCreateRelease(version *semver.Version) *PlatformR
257
257
return release
258
258
}
259
259
260
+ // GetManuallyInstalledRelease returns (*PlatformRelease, true) if the Platform has
261
+ // a manually installed release or (nil, false) otherwise.
262
+ func (platform * Platform ) GetManuallyInstalledRelease () (* PlatformRelease , bool ) {
263
+ res , ok := platform .Releases [semver .MustParse ("" ).NormalizedString ()]
264
+ return res , ok
265
+ }
266
+
260
267
// FindReleaseWithVersion returns the specified release corresponding the provided version,
261
268
// or nil if not found.
262
269
func (platform * Platform ) FindReleaseWithVersion (version * semver.Version ) * PlatformRelease {
0 commit comments