Hello,

This is an informational message to explain the recent changes to
version.Current.

version.Current used to be a version.Binary value consisting of the
version number, an architecture and a series value.

As of this afternoon, version.Current is now a version.Number value;
series and arch have been removed.

Why was this done ?

Over the years version.Current has been a fantastically useful set of
values to have around, and as such has been called into service for a
wide range of uses, many of which were unrelated to its original
purpose of tracking the current version of the juju binary.

To counteract this, the uses of version.Current have been teased apart
and in many places replaced with more appropriate abstractions.
version.Current now exists to track the version number of this version
of Juju -- that's it.

Where has version.Current.Number gone ?

version.Current _is_ the version.Number now.

Where has version.Current.Arch gone ?

The arch of the machine the code is running on is available from
github.com/juju/utils/arch.HostArch()

You can patch it with

s.PatchValue(&arch.HostArch, func() string { "new arch" / arch.Arm64
or other constant })

Please be mindful to only use arch.HostArch when you want the
architecture of the machine you are running on. In many cases, if you
want the architecture of the processor you are running on
runtime.GOARCH may be more appropriate.

Where has version.Current.Series gone ?

The series of the machine the code is running on is available from
github.com/juju/utils/series.HostSeries()

You can patch it with

s.PatchValue(&series.HostSeries, func() string { "new series" })

Please be mindful to only use series.HostSeries() when you want the
_series_ that matches the machine you are running on. In many cases,
if you want the operating system, runtime.GOOS may be more
appropriate.

Thanks

Dave

-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev

Reply via email to