osinfo

package
v0.0.0-...-b1dc9a9 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package osinfo can be used to read OS and vendor related information from a known source file. For Linux-based systems, the /etc/os-release file is used.

This package does not support Windows based systems.

Index

Constants

View Source
const (
	// OSName is given by runtime.GOOS.
	OSName = runtime.GOOS
	// OSReleaseFilePath lists the location of the os-release file in the Linux system.
	OSReleaseFilePath = "/etc/os-release"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	OSName    string
	OSVendor  string
	OSVersion string
}

Data contains the OS related data.

func ReadData

func ReadData(ctx context.Context, rc FileReadCloser, os, filePath string) (Data, error)

ReadData returns the OS related information. In case of Windows, the vendor and version are empty.

type FileReadCloser

type FileReadCloser func(string) (io.ReadCloser, error)

FileReadCloser is a function which reads an input file and returns the io.ReadCloser. It is created to facilitate testing.

Jump to

Keyboard shortcuts

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