All Projects → knqyf263 → Go Deb Version

knqyf263 / Go Deb Version

Licence: mit
A golang library for parsing deb package versions

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Deb Version

Isobmff
C++ Library for ISO/IEC 14496-12 - ISO Base Media File Format (QuickTime, MPEG-4, HEIF, etc)
Stars: ✭ 157 (+647.62%)
Mutual labels:  parser, library
Length.js
📏 JavaScript library for length units conversion.
Stars: ✭ 292 (+1290.48%)
Mutual labels:  parser, library
Sdk
Library for using Grafana' structures in Go programs and client for Grafana REST API.
Stars: ✭ 193 (+819.05%)
Mutual labels:  parser, library
Typin
Declarative framework for interactive CLI applications
Stars: ✭ 126 (+500%)
Mutual labels:  parser, library
Swaggen
OpenAPI/Swagger 3.0 Parser and Swift code generator
Stars: ✭ 385 (+1733.33%)
Mutual labels:  parser, library
Phplrt
PHP Language Recognition Tool
Stars: ✭ 127 (+504.76%)
Mutual labels:  parser, library
Php Svg
Vector graphics (SVG) library for PHP
Stars: ✭ 256 (+1119.05%)
Mutual labels:  parser, library
Rst
PHP library to parse reStructuredText documents
Stars: ✭ 90 (+328.57%)
Mutual labels:  parser, library
Anglesharp
👼 The ultimate angle brackets parser library parsing HTML5, MathML, SVG and CSS to construct a DOM based on the official W3C specifications.
Stars: ✭ 4,018 (+19033.33%)
Mutual labels:  parser, library
Shortcode
Advanced shortcode (BBCode) parser and engine for PHP
Stars: ✭ 331 (+1476.19%)
Mutual labels:  parser, library
Commonmark Java
Java library for parsing and rendering CommonMark (Markdown)
Stars: ✭ 1,675 (+7876.19%)
Mutual labels:  parser, library
Compiler
The Hoa\Compiler library.
Stars: ✭ 458 (+2080.95%)
Mutual labels:  parser, library
Simplepie
A simple Atom/RSS parsing library for PHP.
Stars: ✭ 1,389 (+6514.29%)
Mutual labels:  parser, library
Libnmea
Lightweight C library for parsing NMEA 0183 sentences
Stars: ✭ 146 (+595.24%)
Mutual labels:  parser, library
Argumentum
C++ command line parsing library
Stars: ✭ 92 (+338.1%)
Mutual labels:  parser, library
Vmime
VMime Mail Library
Stars: ✭ 218 (+938.1%)
Mutual labels:  parser, library
Cat
Plain C library for parsing AT commands for use in host devices.
Stars: ✭ 77 (+266.67%)
Mutual labels:  parser, library
Internettools
XPath/XQuery 3.1 interpreter for Pascal with compatibility modes for XPath 2.0/XQuery 1.0/3.0, custom and JSONiq extensions, XML/HTML parsers and classes for HTTP/S requests
Stars: ✭ 82 (+290.48%)
Mutual labels:  parser, library
Regex
The Hoa\Regex library.
Stars: ✭ 308 (+1366.67%)
Mutual labels:  parser, library
Javalang
Pure Python Java parser and tools
Stars: ✭ 408 (+1842.86%)
Mutual labels:  parser, library

go-deb-version

Build Status Coverage Status Go Report Card MIT License

A Go library for parsing package versions

go-deb-version is a library for parsing and comparing versions

Versions used with go-deb-version must follow deb-version (ex. 2:6.0-9ubuntu1)
The implementation is based on Debian Policy Manual

OS: Debian, Ubnutu

Installation and Usage

Installation can be done with a normal go get:

$ go get github.com/knqyf263/go-deb-version

Version Parsing and Comparison

import "github.com/knqyf263/go-deb-version"

v1, err := version.NewVersion("2:6.0-9")
v2, err := version.NewVersion("2:6.0-9ubuntu1")

// Comparison example. There is also GreaterThan, Equal.
if v1.LessThan(v2) {
    fmt.Printf("%s is less than %s", v1, v2)
}

Version Sorting

raw := []string{"7.4.052-1ubuntu3.1", "7.4.052-1ubuntu3", "7.1-022+1ubuntu1", "7.1.291-1", "7.3.000+hg~ee53a39d5896-1"}
vs := make([]version.Version, len(raw))
for i, r := range raw {
	v, _ := version.NewVersion(r)
	vs[i] = v
}

sort.Slice(vs, func(i, j int) bool {
	return vs[i].LessThan(vs[j])
})

Contribute

  1. fork a repository: github.com/knqyf263/go-deb-version to github.com/you/repo
  2. get original code: go get github.com/knqyf263/go-deb-version
  3. work on original code
  4. add remote to your repo: git remote add myfork https://github.com/you/repo.git
  5. push your changes: git push myfork
  6. create a new Pull Request

License

MIT

Author

Teppei Fukuda

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].