os

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package os provides OS Release information, /etc/os-release. Instead of returning a Go struct, it returns JSON serialized bytes. A function to deserialize the JSON serialized bytes into am os.OS struct is provided.

Note: the package name is os and not the final element of the import path (json).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(p []byte) (*o.OS, error)

Deserialize takes some JSON serialized bytes and unmarshals them as os.OS.

func Get

func Get() (p []byte, err error)

Get gets the OS release information, /etc/os-release, as JSON serialized bytes using the package's global Profiler.

func Marshal

func Marshal(os *o.OS) ([]byte, error)

Marshal is an alias for Serialize using the package's global profiler.

func Serialize

func Serialize(os *o.OS) (p []byte, err error)

Serialize os.OS as JSON using the package's global Profiler.

func Unmarshal

func Unmarshal(p []byte) (*o.OS, error)

Unmarshal is an alias for Deserialize.

Types

type Profiler

type Profiler struct {
	*o.Profiler
}

Profiler processes the OS release information, /etc/os-release, using JSON.

func NewProfiler

func NewProfiler() (prof *Profiler, err error)

Returns an initialized Profiler; ready to use.

func (*Profiler) Get

func (prof *Profiler) Get() (p []byte, err error)

Get gets the OS release information, /etc/os-release, as JSON serialized bytes.

func (*Profiler) Marshal

func (prof *Profiler) Marshal(os *o.OS) ([]byte, error)

Marshal is an alias for Serialize.

func (*Profiler) Serialize

func (prof *Profiler) Serialize(os *o.OS) ([]byte, error)

Serialize os.OS as JSON

Jump to

Keyboard shortcuts

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