Lenient version comparison for mod-loader ecosystems: loose semver as SMAPI and BepInEx read it, and .NET System.Version ordering. Package semverish, module github.com/Rethunk-Tech/go-semverish.
Mod authors and mod managers write versions loosely: v1.2, 1.0.0.1, 1.0-beta-2, 2.0-unofficial.3-author. semverish orders them the way SMAPI does, never panics on a string it cannot read, and says so (ok == false) instead of guessing. CompareDotNet orders them the way .NET's System.Version does, which BepInEx 5 uses. Standard library only.
go get github.com/Rethunk-Tech/go-semverishA worked example and the contracts: HUMANS.md.
Compareorders two strings, andParseplusVersion.Compareorder without re-parsing.- Two to four numbers, a missing number is 0, an optional
vorV, build metadata ignored. - SMAPI's prerelease rules:
.and-both separate identifiers,unofficialranks lowest. - Prerelease numbers of any length compare by value, so a hostile string cannot break transitivity.
CompareDotNetfollowsSystem.Version:1.0is below1.0.0, and1.0.0-betais not a version.
| Doc | Audience |
|---|---|
| HUMANS.md | Running and using the package |
| AGENTS.md | Internals, invariants, and why |
| CONTRIBUTING.md | Process — commits, tests, docs |
| SECURITY.md | Vulnerability disclosure |
| CHANGELOG.md | Release notes |
MIT — see LICENSE. © 2026 Rethunk.Tech, LLC.