1 // Copyright 2022 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build windows 6 7 package osinfo 8 9 import ( 10 "fmt" 11 12 "golang.org/x/sys/windows" 13 ) 14 15 // Version returns the OS version name/number. 16 func Version() (string, error) { 17 info := windows.RtlGetVersion() 18 return fmt.Sprintf("%d.%d.%d", info.MajorVersion, info.MinorVersion, info.BuildNumber), nil 19 } 20