osinfo

package
v0.0.0-...-8bfff4f Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: Apache-2.0 Imports: 7 Imported by: 1

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