semver

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: BSL-1.0 Imports: 0 Imported by: 0

README

semver

GoDoc

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/misc/semver.

Example

Source:

package main

import (
	"fmt"
	"github.com/vbsw/misc/semver"
)

func main() {
	version = semver.New(1, 0, 2, "", "")
	fmt.Println("version:", version)
}

Output:

version: 1.0.2

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 String

func String(major, minor, patch uint, preRel, metadata string) string

String returns major, minor and patch number with additional preRel and metadata formatted "<major>.<minor>.<patch>[-<preRel>][+<metadata>]".

Types

type Version

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

Version is the interface to access version numbers.

func New

func New(major, minor, patch uint, more ...string) Version

New returns an object implementing the Version interface. Additional parameters are pre-release label and metadata.

Jump to

Keyboard shortcuts

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