Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckVersionRequirement ¶
CheckVersionRequirement checks if the current version meets the minimum requirement. Returns nil if the requirement is met, or a VersionError if not. If currentVersion is empty (unknown), returns nil for graceful degradation.
func CompareVersions ¶
CompareVersions compares two versions and returns:
- 1 if current > other
- 0 if current == other
- -1 if current < other
func IsVersionSupported ¶
IsVersionSupported checks if the current version meets the minimum version requirement. Returns true if current >= minimum, false otherwise. If either version string is empty or invalid, returns true for graceful degradation.
Types ¶
type Version ¶
type Version struct {
Major int
Minor int
Patch int
// Original stores the original version string (e.g., "16.7.0-ee")
Original string
}
Version represents a semantic version with major, minor, and patch components.
func ParseVersion ¶
ParseVersion extracts semantic version from GitLab version strings. Examples:
- "16.7.0-ee" -> Version{16, 7, 0, "16.7.0-ee"}
- "15.11.3-ce" -> Version{15, 11, 3, "15.11.3-ce"}
- "17.0.0" -> Version{17, 0, 0, "17.0.0"}
- "v16.7.0" -> Version{16, 7, 0, "v16.7.0"}
Returns an error if the version string is malformed or empty.
type VersionError ¶
type VersionError struct {
// CurrentVersion is the detected GitLab version
CurrentVersion string
// RequiredVersion is the minimum required GitLab version
RequiredVersion string
// Feature is the feature or command that requires the minimum version
Feature string
// Host is the GitLab host
Host string
// Message is a descriptive error message
Message string
}
VersionError represents a version compatibility error.
func NewVersionError ¶
func NewVersionError(currentVersion, requiredVersion, feature, host string) *VersionError
NewVersionError creates a new VersionError with the given details.
func (*VersionError) Error ¶
func (e *VersionError) Error() string
Error implements the error interface.