Compare commits

...

7 Commits

Author SHA1 Message Date
2e97859b87 Remove old dependency on x/exp/slices in favor of stdlib 2025-09-12 22:09:49 +02:00
6718928860 Add README 2023-10-03 20:39:44 +00:00
0b2b067575 Add package doc comment 2023-06-22 14:42:16 -07:00
1a31c082d9 Remove unneeded embed import 2023-06-22 14:37:27 -07:00
b160383186 Remove old GPL copyright header 2023-06-22 14:36:28 -07:00
1ef50f776d Add MIT license 2023-06-22 14:34:04 -07:00
d961786040 Add go.mod 2023-06-22 14:33:18 -07:00
6 changed files with 32 additions and 41 deletions

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Elara Musayelyan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

4
README.md Normal file
View File

@@ -0,0 +1,4 @@
# vercmp
[![Go Reference](https://pkg.go.dev/badge/go.elara.ws/vercmp.svg)](https://pkg.go.dev/go.elara.ws/vercmp)
This is a simple library that compares two versions using an algorithm loosely based on the `rpmvercmp` algorithm.

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module go.elara.ws/vercmp
go 1.21

0
go.sum Normal file
View File

View File

@@ -1,29 +1,11 @@
/*
* LURE - Linux User REpository
* Copyright (C) 2023 Arsen Musayelyan
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Package vercmp provides comparison between two arbitrary version strings.
// It uses a modified implementation of the rpmvercmp algorithm used by the RPM package manager.
package vercmp
import (
_ "embed"
"slices"
"strconv"
"strings"
"golang.org/x/exp/slices"
)
// Compare compares two version strings.

View File

@@ -1,27 +1,8 @@
/*
* LURE - Linux User REpository
* Copyright (C) 2023 Arsen Musayelyan
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package vercmp
import (
"slices"
"testing"
"golang.org/x/exp/slices"
)
func TestSepLabel(t *testing.T) {