github.com/rogpeppe/juju@v0.0.0-20140613142852-6337964b789e/version/osversion_darwin.go (about)

     1  // Copyright 2014 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  // +build darwin
     5  
     6  package version
     7  
     8  import (
     9  	"syscall"
    10  )
    11  
    12  func sysctlVersion() (string, error) {
    13  	return syscall.Sysctl("kern.osrelease")
    14  }
    15  
    16  var getSysctlVersion = sysctlVersion
    17  
    18  // osVersion returns the best approximation to what version this machine is.
    19  // If we are unable to determine the OSVersion, we return "unknown".
    20  func osVersion() string {
    21  	return macOSXSeriesFromKernelVersion(getSysctlVersion)
    22  }