mirror of
https://github.com/rancher/rke.git
synced 2025-08-31 14:36:32 +00:00
16 lines
254 B
Go
16 lines
254 B
Go
package util
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/coreos/go-semver/semver"
|
|
)
|
|
|
|
func StrToSemVer(version string) (*semver.Version, error) {
|
|
v, err := semver.NewVersion(strings.TrimPrefix(version, "v"))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return v, nil
|
|
}
|