From 86b3703182aa210a4a83404f68c2d457166e732a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 17 Apr 2019 12:42:39 +0200 Subject: [PATCH] Deprecate pkg/system.GetOSVersion() in favor of hcsshim/osversion.Get() Signed-off-by: Sebastiaan van Stijn --- pkg/system/syscall_windows.go | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/pkg/system/syscall_windows.go b/pkg/system/syscall_windows.go index eb19f9c850..67bec7e30b 100644 --- a/pkg/system/syscall_windows.go +++ b/pkg/system/syscall_windows.go @@ -5,6 +5,7 @@ import ( "syscall" "unsafe" + "github.com/Microsoft/hcsshim/osversion" "github.com/sirupsen/logrus" "golang.org/x/sys/windows" ) @@ -61,12 +62,7 @@ var ( // OSVersion is a wrapper for Windows version information // https://msdn.microsoft.com/en-us/library/windows/desktop/ms724439(v=vs.85).aspx -type OSVersion struct { - Version uint32 - MajorVersion uint8 - MinorVersion uint8 - Build uint16 -} +type OSVersion osversion.OSVersion // https://msdn.microsoft.com/en-us/library/windows/desktop/ms724833(v=vs.85).aspx type osVersionInfoEx struct { @@ -85,18 +81,9 @@ type osVersionInfoEx struct { // GetOSVersion gets the operating system version on Windows. Note that // dockerd.exe must be manifested to get the correct version information. +// Deprecated: use github.com/Microsoft/hcsshim/osversion.Get() instead func GetOSVersion() OSVersion { - var err error - 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 + return OSVersion(osversion.Get()) } func (osv OSVersion) ToString() string {