whatmac

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2020 License: MIT Imports: 4 Imported by: 0

README

Whatmac

Library written in Golang to dumb information about a macOS operating system

Why?
  • I initially made this library for fun.
  • Allows getting macOS version in an easy way, without having to call an external command.
Getting started
  • To get started download the module into your repository

$ go get github.com/diegomagdaleno/whatmac

  • You are ready to Go!
Example
package main

import (
	"fmt"

	"github.com/diegomagdaleno/whatmac"
)

func main() {
	fmt.Println(whatmac.GetProductVersionAsFloat())
}

This in my case returns 10.16 that can be used for comparing.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetProductBuildVersion

func GetProductBuildVersion() string

GetProductBuildVersion gets the build version of the current running macOS instance. Returns a string

func GetProductCopyright

func GetProductCopyright() string

GetProductCopyright gets the copyright that was acssigned to the current running macOS instance. Returns a string

func GetProductName

func GetProductName() string

GetProductName gets the current Product name of the current running macOS instance. It should always return macOS, unless running on another Darwin-like operating system. Returns a string

func GetProductUserVisibleVersion

func GetProductUserVisibleVersion() string

GetProductUserVisibleVersion gets the user visible version of the current running macOS instance. This is differnt from the real product version that the macOS instance might be running. So it is suggested to only use this if the program displays information to the user, if you want to compare versions this isnt recommended, it is recommended to check GetProductVersionAsFloat. Returns a string

func GetProductUserVisibleVersionAsFloat

func GetProductUserVisibleVersionAsFloat() float64

GetProductUserVisibleVersionAsFloat allows you to get the version that user sees in multiple menus as a float64 variable, however, it is not recommended to use this for precise checks, as the user visible version might defer from the real version the macOS instance is running. Returns a float64

func GetProductVersion

func GetProductVersion() string

GetProductVersion gets the real product version of the current macOS instance, emphasis in real macOS version, however, this function is still not recommened if you want to do a comparison, if you wish to do a comparison, it is recommeded to use GetProductVersionAsFloat since strings are not allowed to perform comparisons in Golang. Returns a string

func GetProductVersionAsFloat

func GetProductVersionAsFloat() float64

GetProductVersionAsFloat returns a float64 variable of the real macOS version, this is stronly recommended to use if your program is performining comparions, however, it is not suggested to execute functions like "to round" to the returned value, as this could make the program get a wrong macOS version

func GetiOSSupportVersion

func GetiOSSupportVersion() string

GetiOSSupportVersion gets the current iOSSuppoertVersion of the macOS instance, this is also called Catalyst or Marzipan, as a fair warning, versions before macOS Mojave (10.14) do not have an iOSSupportVersion so this string might be empty, is recommended to handle this in your program. Returns a string

func GetiOSSupportVersionAsFloat

func GetiOSSupportVersionAsFloat() float64

GetiOSSupportVersionAsFloat returns a float64variable of the current iOS support in the running macOS instace allowing you to perform comparison operations. Returns a float64

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL