Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
lewis e28644e8d9 | 1 year ago | |
---|---|---|
.. | ||
.gitignore | 5 years ago | |
.travis.yml | 5 years ago | |
LICENSE | 7 years ago | |
README.md | 5 years ago | |
compare.go | 5 years ago | |
constraint.go | 7 years ago | |
doc.go | 7 years ago | |
group.go | 5 years ago | |
normalize.go | 7 years ago | |
sort.go | 7 years ago | |
stability.go | 7 years ago |
Version normalizer and comparison library for go, heavy based on PHP version_compare function and Version comparsion libs from Composer PHP project
The recommended way to install go-version
go get github.com/mcuadros/go-version
How import the package
import (
"github.com/mcuadros/go-version"
)
version.Normalize()
: Normalizes a version string to be able to perform comparisons on it
version.Normalize("10.4.13-b")
//Returns: 10.4.13.0-beta
version.CompareSimple()
: Compares two normalizated version number strings
version.CompareSimple("1.2", "1.0.1")
//Returns: 1
version.CompareSimple("1.0rc1", "1.0")
//Returns: -1
version.Compare()
: Compares two normalizated version number strings, for a particular relationship
version.Compare("1.0-dev", "1.0", "<")
//Returns: true
version.Compare("1.0rc1", "1.0", ">=")
//Returns: false
version.Compare("2.3.4", "v3.1.2", "<")
//Returns: true
version.ConstrainGroup.Match()
: Match a given version againts a group of constrains, read about constraint string format at Composer documentation
c := version.NewConstrainGroupFromString(">2.0,<=3.0")
c.Match("2.5.0beta")
//Returns: true
c := version.NewConstrainGroupFromString("~1.2.3")
c.Match("1.2.3.5")
//Returns: true
version.Sort()
: Sorts a string slice of version number strings using version.CompareSimple()
version.Sort([]string{"1.10-dev", "1.0rc1", "1.0", "1.0-dev"})
//Returns []string{"1.0-dev", "1.0rc1", "1.0", "1.10-dev"}
MIT, see LICENSE
本项目是群体化方法与技术的开源实现案例,在基于Gitea的基础上,进一步支持社交化的协同开发、协同学习、协同研究等群体创新实践服务,特别是针对新一代人工智能技术特点,重点支持项目管理、git代码管理、大数据集存储管理与智能计算平台接入。
Go SVG JavaScript Vue HTML other
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》