Commit d79bad83 authored by renovate's avatar renovate
Browse files

Update module hashicorp/go-version to v1

parent a7e5d900
Pipeline #10468 passed with stages
in 2 minutes and 27 seconds
......@@ -9,7 +9,7 @@ require (
github.com/dustin/go-humanize v0.0.0-20200219035652-afde56e7acac
github.com/google/subcommands v1.0.1
github.com/gorilla/handlers v1.4.0 // indirect
github.com/hashicorp/go-version v0.0.0-20180716215031-270f2f71b1ee
github.com/hashicorp/go-version v1.2.1
github.com/mattes/migrate v0.0.0-20180508041624-4768a648fbd9
github.com/mattn/go-sqlite3 v0.0.0-20200618132256-aa77c03e2fcb
github.com/openzipkin/zipkin-go v0.1.3 // indirect
......
language: go
go:
- 1.0
- 1.1
- 1.2
- 1.3
- 1.4
- 1.9
- "1.10"
script:
- go test
# Versioning Library for Go
[![Build Status](https://travis-ci.org/hashicorp/go-version.svg?branch=master)](https://travis-ci.org/hashicorp/go-version)
[![Build Status](https://circleci.com/gh/hashicorp/go-version/tree/master.svg?style=svg)](https://circleci.com/gh/hashicorp/go-version/tree/master)
[![GoDoc](https://godoc.org/github.com/hashicorp/go-version?status.svg)](https://godoc.org/github.com/hashicorp/go-version)
go-version is a library for parsing versions and version constraints,
and verifying versions against a set of constraints. go-version
......
module github.com/hashicorp/go-version
......@@ -10,14 +10,25 @@ import (
)
// The compiled regular expression used to test the validity of a version.
var versionRegexp *regexp.Regexp
var (
versionRegexp *regexp.Regexp
semverRegexp *regexp.Regexp
)
// The raw regular expression string used for testing the validity
// of a version.
const VersionRegexpRaw string = `v?([0-9]+(\.[0-9]+)*?)` +
`(-([0-9]+[0-9A-Za-z\-~]*(\.[0-9A-Za-z\-~]+)*)|(-?([A-Za-z\-~]+[0-9A-Za-z\-~]*(\.[0-9A-Za-z\-~]+)*)))?` +
`(\+([0-9A-Za-z\-~]+(\.[0-9A-Za-z\-~]+)*))?` +
`?`
const (
VersionRegexpRaw string = `v?([0-9]+(\.[0-9]+)*?)` +
`(-([0-9]+[0-9A-Za-z\-~]*(\.[0-9A-Za-z\-~]+)*)|(-?([A-Za-z\-~]+[0-9A-Za-z\-~]*(\.[0-9A-Za-z\-~]+)*)))?` +
`(\+([0-9A-Za-z\-~]+(\.[0-9A-Za-z\-~]+)*))?` +
`?`
// SemverRegexpRaw requires a separator between version and prerelease
SemverRegexpRaw string = `v?([0-9]+(\.[0-9]+)*?)` +
`(-([0-9]+[0-9A-Za-z\-~]*(\.[0-9A-Za-z\-~]+)*)|(-([A-Za-z\-~]+[0-9A-Za-z\-~]*(\.[0-9A-Za-z\-~]+)*)))?` +
`(\+([0-9A-Za-z\-~]+(\.[0-9A-Za-z\-~]+)*))?` +
`?`
)
// Version represents a single version.
type Version struct {
......@@ -30,12 +41,24 @@ type Version struct {
func init() {
versionRegexp = regexp.MustCompile("^" + VersionRegexpRaw + "$")
semverRegexp = regexp.MustCompile("^" + SemverRegexpRaw + "$")
}
// NewVersion parses the given version and returns a new
// Version.
func NewVersion(v string) (*Version, error) {
matches := versionRegexp.FindStringSubmatch(v)
return newVersion(v, versionRegexp)
}
// NewSemver parses the given version and returns a new
// Version that adheres strictly to SemVer specs
// https://semver.org/
func NewSemver(v string) (*Version, error) {
return newVersion(v, semverRegexp)
}
func newVersion(v string, pattern *regexp.Regexp) (*Version, error) {
matches := pattern.FindStringSubmatch(v)
if matches == nil {
return nil, fmt.Errorf("Malformed version: %s", v)
}
......@@ -89,7 +112,7 @@ func Must(v *Version, err error) *Version {
// or larger than the other version, respectively.
//
// If you want boolean results, use the LessThan, Equal,
// or GreaterThan methods.
// GreaterThan, GreaterThanOrEqual or LessThanOrEqual methods.
func (v *Version) Compare(other *Version) int {
// A quick, efficient equality check
if v.String() == other.String() {
......@@ -257,6 +280,10 @@ func comparePrereleases(v string, other string) int {
// Equal tests if two versions are equal.
func (v *Version) Equal(o *Version) bool {
if v == nil || o == nil {
return v == o
}
return v.Compare(o) == 0
}
......@@ -265,11 +292,21 @@ func (v *Version) GreaterThan(o *Version) bool {
return v.Compare(o) > 0
}
// GreaterThanOrEqual tests if this version is greater than or equal to another version.
func (v *Version) GreaterThanOrEqual(o *Version) bool {
return v.Compare(o) >= 0
}
// LessThan tests if this version is less than another version.
func (v *Version) LessThan(o *Version) bool {
return v.Compare(o) < 0
}
// LessThanOrEqual tests if this version is less than or equal to another version.
func (v *Version) LessThanOrEqual(o *Version) bool {
return v.Compare(o) <= 0
}
// Metadata returns any metadata that was part of the version
// string.
//
......
# git.autistici.org/ai3/go-common v0.0.0-20200206110359-d4396660b1f0
## explicit
git.autistici.org/ai3/go-common
git.autistici.org/ai3/go-common/clientutil
git.autistici.org/ai3/go-common/serverutil
git.autistici.org/ai3/go-common
git.autistici.org/ai3/go-common/tracing
# github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
github.com/beorn7/perks/quantile
# github.com/cenkalti/backoff v0.0.0-20190506075156-2146c9339422
## explicit
github.com/cenkalti/backoff
# github.com/coreos/go-systemd v0.0.0-20180828140353-eee3db372b31
## explicit
github.com/coreos/go-systemd/daemon
# github.com/dustin/go-humanize v0.0.0-20200219035652-afde56e7acac
## explicit
github.com/dustin/go-humanize
# github.com/golang/protobuf v1.2.0
github.com/golang/protobuf/proto
# github.com/google/subcommands v1.0.1
## explicit
github.com/google/subcommands
# github.com/gorilla/handlers v1.4.0
## explicit
github.com/gorilla/handlers
# github.com/hashicorp/go-version v0.0.0-20180716215031-270f2f71b1ee
# github.com/hashicorp/go-version v1.2.1
## explicit
github.com/hashicorp/go-version
# github.com/mattes/migrate v0.0.0-20180508041624-4768a648fbd9
## explicit
github.com/mattes/migrate
github.com/mattes/migrate/database/sqlite3
github.com/mattes/migrate/source/go-bindata
github.com/mattes/migrate/database
github.com/mattes/migrate/database/sqlite3
github.com/mattes/migrate/source
github.com/mattes/migrate/source/go-bindata
# github.com/mattn/go-sqlite3 v0.0.0-20200618132256-aa77c03e2fcb
## explicit
github.com/mattn/go-sqlite3
# github.com/matttproud/golang_protobuf_extensions v1.0.1
github.com/matttproud/golang_protobuf_extensions/pbutil
# github.com/openzipkin/zipkin-go v0.1.3
## explicit
github.com/openzipkin/zipkin-go
github.com/openzipkin/zipkin-go/reporter/http
github.com/openzipkin/zipkin-go/idgenerator
github.com/openzipkin/zipkin-go/model
github.com/openzipkin/zipkin-go/propagation
github.com/openzipkin/zipkin-go/reporter
github.com/openzipkin/zipkin-go/reporter/http
# github.com/prometheus/client_golang v0.9.1
## explicit
github.com/prometheus/client_golang/prometheus
github.com/prometheus/client_golang/prometheus/promhttp
github.com/prometheus/client_golang/prometheus/internal
github.com/prometheus/client_golang/prometheus/promhttp
# github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
## explicit
github.com/prometheus/client_model/go
# github.com/prometheus/common v0.3.0
## explicit
github.com/prometheus/common/expfmt
github.com/prometheus/common/model
github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg
github.com/prometheus/common/model
# github.com/prometheus/procfs v0.0.0-20190403104016-ea9eea638872
## explicit
github.com/prometheus/procfs
# github.com/robfig/cron v1.2.0
## explicit
github.com/robfig/cron
# go.opencensus.io v0.0.0-20181112172609-91a0276ece6a
## explicit
go.opencensus.io
go.opencensus.io/exemplar
go.opencensus.io/exporter/zipkin
go.opencensus.io/internal
go.opencensus.io/internal/tagencoding
go.opencensus.io/plugin/ochttp
go.opencensus.io/trace
go.opencensus.io/plugin/ochttp/propagation/b3
go.opencensus.io/stats
go.opencensus.io/stats/internal
go.opencensus.io/stats/view
go.opencensus.io/tag
go.opencensus.io/trace/propagation
go.opencensus.io/exemplar
go.opencensus.io/internal
go.opencensus.io/trace
go.opencensus.io/trace/internal
go.opencensus.io/trace/propagation
go.opencensus.io/trace/tracestate
go.opencensus.io/stats/internal
go.opencensus.io/internal/tagencoding
go.opencensus.io
# golang.org/x/sync v0.0.0-20190423024810-112230192c58
## explicit
golang.org/x/sync/singleflight
# gopkg.in/yaml.v2 v2.2.1
## explicit
gopkg.in/yaml.v2
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment