Source file src/cmd/internal/osinfo/os_windows.go

     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  	major, minor, patch := windows.RtlGetNtVersionNumbers()
    18  	return fmt.Sprintf("%d.%d.%d", major, minor, patch), nil
    19  }
    20  

View as plain text