Documentation ¶
Overview ¶
The version package implements version parsing. It also acts as guardian of the current client Juju version number.
Index ¶
- Variables
- func IsUnknownOSForSeriesError(err error) bool
- func IsUnknownSeriesVersionError(err error) bool
- func OSSupportedSeries(os OSType) []string
- func ParseMajorMinor(vers string) (int, int, error)
- func ReleaseVersion() string
- func SeriesVersion(series string) (string, error)
- func SupportedSeries() []string
- type Binary
- func (v Binary) GetBSON() (interface{}, error)
- func (v Binary) GetYAML() (tag string, value interface{})
- func (v Binary) MarshalJSON() ([]byte, error)
- func (vp *Binary) SetBSON(raw bson.Raw) error
- func (vp *Binary) SetYAML(tag string, value interface{}) bool
- func (v Binary) String() string
- func (vp *Binary) UnmarshalJSON(data []byte) error
- type Number
- func (v Number) Compare(w Number) int
- func (v Number) GetBSON() (interface{}, error)
- func (v Number) GetYAML() (tag string, value interface{})
- func (v Number) IsDev() bool
- func (v Number) MarshalJSON() ([]byte, error)
- func (vp *Number) SetBSON(raw bson.Raw) error
- func (vp *Number) SetYAML(tag string, value interface{}) bool
- func (v Number) String() string
- func (vp *Number) UnmarshalJSON(data []byte) error
- type OSType
Constants ¶
This section is empty.
Variables ¶
var Compiler = runtime.Compiler
var Current = Binary{ Number: MustParse(version), Series: osVers, Arch: arch.HostArch(), OS: MustOSFromSeries(osVers), }
Current gives the current version of the system. If the file "FORCE-VERSION" is present in the same directory as the running binary, it will override this.
var Zero = Number{}
Zero is occasionally convenient and readable. Please don't change its value.
Functions ¶
func IsUnknownOSForSeriesError ¶
IsUnknownOSForSeriesError returns true if err is of type unknownOSForSeriesError.
func IsUnknownSeriesVersionError ¶
IsUnknownSeriesVersionError returns true if err is of type unknownSeriesVersionError.
func OSSupportedSeries ¶
OSSupportedSeries returns the series of the specified OS on which we can run Juju workloads.
func ParseMajorMinor ¶
ParseMajorMinor takes an argument of the form "major.minor" and returns ints major and minor.
func ReleaseVersion ¶
func ReleaseVersion() string
ReleaseVersion looks for the value of VERSION_ID in the content of the os-release. If the value is not found, the file is not found, or an error occurs reading the file, an empty string is returned.
func SeriesVersion ¶
SeriesVersion returns the version for the specified series.
func SupportedSeries ¶
func SupportedSeries() []string
SupportedSeries returns the series on which we can run Juju workloads.
Types ¶
type Binary ¶
Binary specifies a binary version of juju.
func MustParseBinary ¶
MustParseBinary parses a binary version and panics if it does not parse correctly.
func ParseBinary ¶
ParseBinary parses a binary version of the form "1.2.3-series-arch".
func (Binary) GetBSON ¶
GetBSON turns v into a bson.Getter so it can be saved directly on a MongoDB database with mgo.
func (Binary) MarshalJSON ¶
func (*Binary) SetBSON ¶
SetBSON turns v into a bson.Setter so it can be loaded directly from a MongoDB database with mgo.
func (*Binary) UnmarshalJSON ¶
type Number ¶
Number represents a juju version. When bugs are fixed the patch number is incremented; when new features are added the minor number is incremented and patch is reset; and when compatibility is broken the major version is incremented and minor and patch are reset. The build number is automatically assigned and has no well defined sequence. If the build number is greater than zero or the tag is non-empty it indicates that the release is still in development. For versions older than 1.19.3, development releases were indicated by an odd Minor number of any non-zero build number.
func Parse ¶
Parse parses the version, which is of the form 1.2.3 giving the major, minor and release versions respectively.
func (Number) Compare ¶
Compare returns -1, 0 or 1 depending on whether v is less than, equal to or greater than w.
func (Number) GetBSON ¶
GetBSON turns v into a bson.Getter so it can be saved directly on a MongoDB database with mgo.
func (Number) IsDev ¶
IsDev returns whether the version represents a development version. A version with a tag or a nonzero build component is considered to be a development version. Versions older than or equal to 1.19.3 (the switch over time) check for odd minor versions.
func (Number) MarshalJSON ¶
func (*Number) SetBSON ¶
SetBSON turns v into a bson.Setter so it can be loaded directly from a MongoDB database with mgo.
func (*Number) UnmarshalJSON ¶
type OSType ¶
type OSType int
func GetOSFromSeries ¶
GetOSFromSeries will return the operating system based on the series that is passed to it
func MustOSFromSeries ¶
MustOSFromSeries will panic if the series represents an "unknown" operating system