Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dominodatalab/os-release
:computer: Parse and load OS identification data
https://github.com/dominodatalab/os-release
golang linux
Last synced: 29 days ago
JSON representation
:computer: Parse and load OS identification data
- Host: GitHub
- URL: https://github.com/dominodatalab/os-release
- Owner: dominodatalab
- License: apache-2.0
- Created: 2019-03-16T15:24:27.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-22T01:18:12.000Z (over 5 years ago)
- Last Synced: 2024-06-21T16:47:05.710Z (6 months ago)
- Topics: golang, linux
- Language: Go
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 17
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# os-release
[![Build Status](https://travis-ci.org/dominodatalab/os-release.svg?branch=master)](https://travis-ci.org/dominodatalab/os-release)
[![Go Report Card](https://goreportcard.com/badge/github.com/dominodatalab/os-release)](https://goreportcard.com/report/github.com/dominodatalab/os-release)
[![GoDoc](https://godoc.org/github.com/dominodatalab/os-release?status.svg)](https://godoc.org/github.com/dominodatalab/os-release)Parse and load OS identification data.
## Usage
Example usage is show below.
```go
package mainimport (
"fmt"
"io/ioutil"osr "github.com/dominodatalab/os-release"
)func main() {
contents, err := ioutil.ReadFile("/etc/os-release")
if err != nil {
panic(err)
}
info := osr.Parse(string(contents))// Inspect the distro lineage
fmt.Printf("Is %q like fedora? %t", info.Name, info.IsLikeFedora())
fmt.Printf("Is %q like debian? %t", info.Name, info.IsLikeDebian())// List all of the fields on the Data struct, such as ID/Name/Version and others.
fmt.Printf("%#v", info)
}
```