Coder Social home page Coder Social logo

wille / osutil Goto Github PK

View Code? Open in Web Editor NEW
27.0 3.0 13.0 21 KB

Go library to easily detect current operating system, current Linux distribution, macOS version and more...

License: MIT License

Go 100.00%
os operating system operatingsystem golang go linux macos mac windows

osutil's Introduction

osutil

Travis GoDoc Go Report Card

Go library to detect operating system version

Usage

import "github.com/wille/osutil"

// macOS, Windows, Linux, FreeBSD...
osutil.Name

// macOS: 10.17, 10.16...
// Windows: 10, 8.1, Vista...
//
osutil.GetVersion()

// Returns nicely formatted string
// Windows 10, macOS 10.17 Sierra
osutil.GetDisplay()

osutil's People

Contributors

abbbi avatar devsike avatar ilyapashuk avatar liut avatar wille avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

osutil's Issues

License?

Hi. What License is this released under?

Error in Chinese operating system

package main

import (
	"fmt"

	"github.com/wille/osutil"
)

func main() {
	fmt.Println(osutil.GetDisplay())
}

panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
github.com/wille/osutil.GetVersion(0x43b461, 0x5a5ea0)
E:/Home/go/pkg/mod/github.com/wille/[email protected]/os_windows.go:41 +0x32c
github.com/wille/osutil.GetDisplay(...)
E:/Home/go/pkg/mod/github.com/wille/[email protected]/os_windows.go:69

cmd>ver

Microsoft Windows [版本 10.0.18362.657]

Cannot detect openSUSE 15.3

The library fails to properly recognize openSUSE 15.3

osutil.GetDisplay()
expected: openSUSE
actual: Linux

distro := osutil.GetDist()

expected: distro.Display to be openSUSE
actual: distro.Display is empty

expected: distro.Codename to be Leap
actual: distro.Codename is empty

Notes:
distro.Release is correct, 15.3

lsb_release - command is not available

cat /etc/os-release returns

NAME="openSUSE Leap"
VERSION="15.3"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.3"
PRETTY_NAME="openSUSE Leap 15.3"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.3"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"

There is no file /etc/SuSE-release

License missing

Please specify license of this code.
Lack of the license prevents me from using it and potentially contributing back to it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.