Categorygithub.com/JustinTimperio/osinfo
repositorypackage
0.0.0-20210705143940-9e63396e3c2f
Repository: https://github.com/justintimperio/osinfo.git
Documentation: pkg.go.dev

# README

osinfo

GitHub Go Reference Go Report Card Codacy Badge

What is osinfo?

OSinfo is a cross-platform OS Version collection tool. It is designed to unify multiple OS detection methods in a single module that can easily be integrated into other projects.

Officially Supported:

WindowsMacOSLinuxBSD
Windows Server 201210.6 - Snow LeopardUbuntuFreeBSD
Windows Server 201610.7 - LionDebianOpenBSD
Windows Server 201910.8 - Mountain LionMXLinux
Windows 710.9 - MavericksMint
Windows 810.10 - YosemiteKali
Windows 1010.11 - El CapitanParrotOS
10.12 - SierraOpenSUSE Leap
10.13 - High SierraOpenSUSE TumbleWeed
10.14 - MojaveOpenSUSE SLES
10.15 - CatalinaArch
11.0 - Big SurManjaro
Alpine
Fedora
RHEL
CentOS
Oracle

Example Usage

  1. Create fetchinfo.go
   package main

   import (
      "fmt"

      "github.com/JustinTimperio/osinfo"
   )

   func main() {
		release := osinfo.GetVersion()
		fmt.Printf(release.String())
	 }
  1. go mod init
  2. go mod tidy
  3. go run fetchinfo.go

Example Outputs

--------------------

Runtime: linux
Architecture: amd64
OS Name: Arch Linux
Version: rolling
Kernel: 5.11.2-arch1-1
Distro: arch
Package Manager: pacman

--------------------

Runtime: linux
Architecture: amd64
OS Name: Debian GNU/Linux 10 (buster)
Version: 10
Kernel: 4.19.0-13-amd64
Distro: debian
Package Manager: apt

--------------------

Runtime: windows
Architecture: amd64
OS Name: Windows Server 2016 Standard Evaluation
Version: 10
Build: 14393

--------------------

Runtime: darwin
Architecture: amd64
OS Name: Mac OS X
Version: 11.0.1
Version Name: MacOS - Big Sur 

--------------------

Runtime: freebsd
Architecture: amd64
OS Name: FreeBSD 12.1-RELEASE
Version: 12.1-RELEASE
Kernel: 1201000
Package Manger: pkg

--------------------

Runtime: openbsd 
Architecture: amd64
OS Name: OpenBSD 6.7 
Version: 6.7 
Kernel: GENERIC.MP#182 
Package Manger: pkg_add

--------------------