Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JustinTimperio/osinfo
A Cross-Platform Module for Collecting OS Information in Golang
https://github.com/JustinTimperio/osinfo
cross-platform darwin freebsd go golang linux openbsd os-info os-information osinfo osx windows windowserver
Last synced: 3 days ago
JSON representation
A Cross-Platform Module for Collecting OS Information in Golang
- Host: GitHub
- URL: https://github.com/JustinTimperio/osinfo
- Owner: JustinTimperio
- License: mit
- Created: 2021-03-05T17:30:59.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-07-05T14:39:40.000Z (over 3 years ago)
- Last Synced: 2024-11-07T11:02:15.817Z (3 days ago)
- Topics: cross-platform, darwin, freebsd, go, golang, linux, openbsd, os-info, os-information, osinfo, osx, windows, windowserver
- Language: Go
- Homepage:
- Size: 51.8 KB
- Stars: 15
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# osinfo
![GitHub](https://img.shields.io/github/license/JustinTimperio/osinfo)
[![Go Reference](https://pkg.go.dev/badge/github.com/JustinTimperio/osinfo.svg)](https://pkg.go.dev/github.com/JustinTimperio/osinfo)
[![Go Report Card](https://goreportcard.com/badge/github.com/JustinTimperio/osinfo)](https://goreportcard.com/report/github.com/JustinTimperio/osinfo)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/180976560a9b46678d9d67053c0d7fc9)](https://www.codacy.com/gh/JustinTimperio/osinfo/dashboard?utm_source=github.com&utm_medium=referral&utm_content=JustinTimperio/osinfo&utm_campaign=Badge_Grade)## 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:
| Windows | MacOS | Linux | BSD |
|---------------------|-----------------------|---------------------|---------|
| Windows Server 2012 | 10.6 - Snow Leopard | Ubuntu | FreeBSD |
| Windows Server 2016 | 10.7 - Lion | Debian | OpenBSD |
| Windows Server 2019 | 10.8 - Mountain Lion | MXLinux | |
| Windows 7 | 10.9 - Mavericks | Mint | |
| Windows 8 | 10.10 - Yosemite | Kali | |
| Windows 10 | 10.11 - El Capitan | ParrotOS | |
| | 10.12 - Sierra | OpenSUSE Leap | |
| | 10.13 - High Sierra | OpenSUSE TumbleWeed | |
| | 10.14 - Mojave | OpenSUSE SLES | |
| | 10.15 - Catalina | Arch | |
| | 11.0 - Big Sur | Manjaro | |
| | | Alpine | |
| | | Fedora | |
| | | RHEL | |
| | | CentOS | |
| | | Oracle | |## Example Usage
1. Create `fetchinfo.go`
```go
package mainimport (
"fmt""github.com/JustinTimperio/osinfo"
)func main() {
release := osinfo.GetVersion()
fmt.Printf(release.String())
}
```
2. `go mod init`
3. `go mod tidy`
4. `go run fetchinfo.go`## Example Outputs
```sh
--------------------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--------------------
```