mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Deprecate pkg/system.GetOSVersion() in favor of hcsshim/osversion.Get()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
6b91ceff74
commit
86b3703182
1 changed files with 4 additions and 17 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/Microsoft/hcsshim/osversion"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
)
|
)
|
||||||
|
@ -61,12 +62,7 @@ var (
|
||||||
|
|
||||||
// OSVersion is a wrapper for Windows version information
|
// OSVersion is a wrapper for Windows version information
|
||||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724439(v=vs.85).aspx
|
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724439(v=vs.85).aspx
|
||||||
type OSVersion struct {
|
type OSVersion osversion.OSVersion
|
||||||
Version uint32
|
|
||||||
MajorVersion uint8
|
|
||||||
MinorVersion uint8
|
|
||||||
Build uint16
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724833(v=vs.85).aspx
|
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724833(v=vs.85).aspx
|
||||||
type osVersionInfoEx struct {
|
type osVersionInfoEx struct {
|
||||||
|
@ -85,18 +81,9 @@ type osVersionInfoEx struct {
|
||||||
|
|
||||||
// GetOSVersion gets the operating system version on Windows. Note that
|
// GetOSVersion gets the operating system version on Windows. Note that
|
||||||
// dockerd.exe must be manifested to get the correct version information.
|
// dockerd.exe must be manifested to get the correct version information.
|
||||||
|
// Deprecated: use github.com/Microsoft/hcsshim/osversion.Get() instead
|
||||||
func GetOSVersion() OSVersion {
|
func GetOSVersion() OSVersion {
|
||||||
var err error
|
return OSVersion(osversion.Get())
|
||||||
osv := OSVersion{}
|
|
||||||
osv.Version, err = windows.GetVersion()
|
|
||||||
if err != nil {
|
|
||||||
// GetVersion never fails.
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
osv.MajorVersion = uint8(osv.Version & 0xFF)
|
|
||||||
osv.MinorVersion = uint8(osv.Version >> 8 & 0xFF)
|
|
||||||
osv.Build = uint16(osv.Version >> 16)
|
|
||||||
return osv
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (osv OSVersion) ToString() string {
|
func (osv OSVersion) ToString() string {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue