This repository has been archived on 2023-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
tomo-old/version.go

33 lines
1.0 KiB
Go

package tomo
import "fmt"
// Version represents a semantic version number.
type Version [3]int
// TODO: when 1.0 is released, remove the notices. remember to update
// CurrentVersion too!
// CurrentVersion returns the current Tomo/Nasin version. Note that until 1.0 is
// released, this does not mean much.
func CurrentVersion () Version {
return Version { 0, 0, 0 }
}
// CompatibleABI returns whether or not two versions are compatible on a binary
// level. Note that until 1.0 is released, this does not mean much.
func (version Version) CompatibleABI (other Version) bool {
return version[0] == other[0] && version[1] == other[1]
}
// CompatibleAPI returns whether or not two versions are compatible on a source
// code level. Note that until 1.0 is released, this does not mean much.
func (version Version) CompatibleAPI (other Version) bool {
return version[0] == other[0]
}
// String returns a string representation of the version.
func (version Version) String () string {
return fmt.Sprint(version[0], ".", version[1], ".", version[2])
}