{"id":26646026,"url":"https://github.com/mark-kubacki/semver","last_synced_at":"2025-03-24T22:56:12.668Z","repository":{"id":19405138,"uuid":"22646965","full_name":"mark-kubacki/semver","owner":"mark-kubacki","description":":100: parse semantic version numbers, and ranges (the most often imitated original)","archived":false,"fork":false,"pushed_at":"2021-06-14T07:45:46.000Z","size":241,"stargazers_count":37,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-23T23:41:45.212Z","etag":null,"topics":["constraints","go","golang","range","semantic-versioning","semantic-versions","semver","zero-alloc"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mark-kubacki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2014-08-05T14:38:04.000Z","updated_at":"2023-08-13T16:04:44.000Z","dependencies_parsed_at":"2022-09-20T03:50:59.807Z","dependency_job_id":null,"html_url":"https://github.com/mark-kubacki/semver","commit_stats":null,"previous_names":["mark-kubacki/semver","wmark/semver"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mark-kubacki%2Fsemver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mark-kubacki%2Fsemver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mark-kubacki%2Fsemver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mark-kubacki%2Fsemver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mark-kubacki","download_url":"https://codeload.github.com/mark-kubacki/semver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245366198,"owners_count":20603439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["constraints","go","golang","range","semantic-versioning","semantic-versions","semver","zero-alloc"],"created_at":"2025-03-24T22:56:12.141Z","updated_at":"2025-03-24T22:56:12.659Z","avatar_url":"https://github.com/mark-kubacki.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Semantic Versioning for Golang\n==============================\n\n[![GoDoc](https://godoc.org/blitznote.com/src/semver?status.png)](https://godoc.org/blitznote.com/src/semver)\n\nA library for parsing and processing of *Versions* and *Ranges* in:\n\n* [Semantic Versioning](http://semver.org/) (semver) v2.0.0 notation\n  * used by npmjs.org, pypi.org…\n* Gentoo's ebuild format\n* The fastest implementation, and the one that'll actually parse all semver variants correctly and without errors.\n* Sorting is in O(n).\n\nDoes not rely on *regular expressions* neither does it use package *reflection*.\n\n```bash\n$ sudo /bin/bash -c 'for g in /sys/bus/cpu/drivers/processor/cpu[0-9]*/cpufreq/scaling_governor; do echo performance \u003e$g; done'\n$ sed -i -e 's@ignore@3rdparty@g' foreign_test.go\n$ go mod tidy\n$ go test -tags 3rdparty -run=XXX -benchmem -bench=.\n\nBenchmark_Compare-24                           1.392 ns/op 0 B/op   0 allocs/op\nBenchmark_NewVersion-24                       32.02 ns/op  0 B/op   0 allocs/op\nBenchmarkSemverNewRange-24                    86.83 ns/op  0 B/op   0 allocs/op\nBenchmark_SortPtr-24                     2768859 ns/op\n\nBenchmarkLibraryTwo_Compare-24                 5.019 ns/op 0 B/op   0 allocs/op\nBenchmarkLibraryTwo_Make-24                  299.5 ns/op  75 B/op   2 allocs/op\nBenchmarkLibraryTwo_ParseRange-24           1357 ns/op   456 B/op  13 allocs/op\nBenchmarkLibraryTwo_Sort-24             12771299 ns/op\n\nBenchmarkLibraryOne_Compare-24              1442 ns/op   480 B/op  17 allocs/op\nBenchmarkLibraryOne_NewVersion-24           1516 ns/op   535 B/op   6 allocs/op\nBenchmarkLibraryOne_NewConstraint-24        7024 ns/op  2092 B/op  18 allocs/op\nBenchmarkLibraryOne_SortPtr-24         668274885 ns/op\n\n# AMD Epyc 7401P, Linux 5.12.10, Go 1.16.5\n# - LibraryOne v1.3.0 sometimes segfaults\n# - LibraryTwo v4 errors on 19.4% of the given versions\n```\n\nLicensed under a [BSD-style license](LICENSE).\n\nUsage\n-----\n\nUsing _go modules_ you'd just:\n\n```go\nimport \"blitznote.com/src/semver/v3\"\n```\n\n… or, with older versions of _Go_ leave out the version suffix `/v…` and:\n\n```bash\n$ dep ensure --add blitznote.com/src/semver@^3\n```\n\nAfter which you can use the module as usual, like this:\n\n```go\nv1 := semver.MustParse(\"1.2.3-beta\")\nv2 := semver.MustParse(\"2.0.0-alpha20140805.456-rc3+build1800\")\nv1.Less(v2) // true\n\nr1, _ := NewRange(\"~1.2\")\nr1.Contains(v1)      // true\nr1.IsSatisfiedBy(v1) // false (pre-releases don't satisfy)\n```\n\nAlso check its [go.dev](https://pkg.go.dev/blitznote.com/src/semver/v3?tab=overview) listing\nand [Gentoo Linux Ebuild File Format](http://devmanual.gentoo.org/ebuild-writing/file-format/),\n[Gentoo's notation of dependencies](http://devmanual.gentoo.org/general-concepts/dependencies/).\n\nPlease Note\n-----------\n\nIt is, ordered from lowest to highest:\n\n    alpha \u003c beta \u003c pre \u003c rc \u003c (no release type/»common«) \u003c r (revision) \u003c p\n\nTherefore it is:\n\n    Version(\"1.0.0-pre1\") \u003c Version(\"1.0.0\") \u003c Version(\"1.0.0-p1\")\n\n### Limitations\n\nVersion 2 no longer supports dot-tag notation.\nThat is, `1.8.rc2` will be rejected, valid are `1.8rc2` and `1.8-rc2`.\n\nContribute\n----------\n\nPull requests are welcome.\n\nFor anything written in Assembly, please contribute your implementation for one\narchitecture only at first. We'll work with this and once it's in, follow up\nwith more if you like.\n\nPlease add your name and email address to a file *AUTHORS* and/or *CONTRIBUTORS*.  \nThanks!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmark-kubacki%2Fsemver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmark-kubacki%2Fsemver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmark-kubacki%2Fsemver/lists"}