HasExtension returns whether the source info contains the extension which satisfies the minimum version requirement. For an extension to be considered 'present' it must have the same major version as the minVersion and a minor version at least as great as the lowest minor version specified.
(id string, minVersion ExtensionVersion)
| 443 | // For an extension to be considered 'present' it must have the same major version as the minVersion and a minor version |
| 444 | // at least as great as the lowest minor version specified. |
| 445 | func (s *SourceInfo) HasExtension(id string, minVersion ExtensionVersion) bool { |
| 446 | for _, ext := range s.Extensions() { |
| 447 | return ext.ID == id && ext.Version.Major == minVersion.Major && ext.Version.Minor >= minVersion.Minor |
| 448 | } |
| 449 | return false |
| 450 | } |
| 451 | |
| 452 | // AddExtension adds an extension record into the SourceInfo. |
| 453 | func (s *SourceInfo) AddExtension(ext Extension) { |