semver

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2019 License: BSL-1.0 Imports: 0 Imported by: 6

README

SemVer

GoDoc Go Report Card

About

SemVer is a Go package that provides functions to create version numbers as defined on http://semver.org. SemVer is published on https://github.com/vbsw/semver and https://gitlab.com/vbsw/semver.

Copyright 2016, Vitali Baumtrok (vbsw@mailbox.org).

SemVer is distributed under the Boost Software License, version 1.0. (See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)

SemVer 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 Boost Software License for more details.

Example

Source:

package main
import (
	"fmt"
	"github.com/vbsw/semver"
)

var version semver.Version

func Version() {
	if version == nil {
		version = semver.New(1,0,2)
	}
	return version
}

func main() {
	fmt.Println("Version:", Version())
}

Output:

Version: 1.0.2

Using Go

Get this project:

$ go get github.com/vbsw/semver

Update a local copy:

$ go get -u github.com/vbsw/semver

Compile:

$ go install github.com/vbsw/semver

Run tests:

$ go test github.com/vbsw/semver

Using Git

Get the master branch and all refs of this project:

$ git clone https://github.com/vbsw/semver.git

See all tags:

$ git tag -l

See local and remote branches:

$ git branch -a

Checkout other branches than master, for example the development branch:

$ git branch development origin/development
$ git checkout development

See tracked remote branches:

$ git branch -vv

Update all tracked branches and all refs:

$ git fetch

References

Documentation

Overview

Package semver is Semantic Versioning as defined on <http://semver.org>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToString

func ToString(major, minor, patch uint) string

ToString returns major, minor and patch number as string formatted "<major>.<minor>.<patch>".

Types

type Version

type Version interface {
	Major() uint
	Minor() uint
	Patch() uint
	String() string
}

Version is the interface to access version numbers.

func New

func New(major, minor, patch uint) Version

New returns an object implementing the Version interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL