Socket
Book a DemoInstallSign in
Socket

xiam.li/interval-notation

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xiam.li/interval-notation

Go Modules
Version
v1.3.0
Version published
Created
Source

Go Interval Notation

This library is used to parse interval notations (e.g. [v1.2,] or [v1,v3)) for versions in Go. The following format of versions are supported:

  • 1
  • 1.2
  • 1.2.3
  • SemanticVersioning
  • Addtionally every version prefixed with a 'v'.

For actually parsing the version and comparing them, it's using SemVer from @Masterminds

Usage

First use go get to import the package:

go get xiam.li/interval-notation

Afterwards you can use like this:

package main

import "xiam.li/interval-notation"

func main() {
  interval_notation.InRange("[v1,v2]", "v1.5.3") // == true
  interval_notation.InRange("[v1,v2]", "v2.5.3") // == false
}

License

MIT © 2023 Dorian Heinrichs

FAQs

Package last updated on 26 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts