version

package
Version: 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 version gets the kernel and version information from the /proc/version file. Instead of returning a Go struct, it returns JSON serialized bytes. A function to deserialize the JSON serialized bytes into a version.Kernel struct is provided.

Note: the package name is version 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) (*v.Kernel, error)

Deserialize takes some JSON serialized bytes and deserializes them as version.Kernel.

func Get

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

Get gets the kernel information from the /proc/version file as JSON serialized bytes using the package's global Profiler.

func Marshal

func Marshal(k *v.Kernel) ([]byte, error)

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

func Serialize

func Serialize(k *v.Kernel) (p []byte, err error)

Serialize version.Kernel as JSON using the package's global Profiler.

func Unmarshal

func Unmarshal(p []byte) (*v.Kernel, error)

Unmarshal is an alias for Deserialize.

Types

type Profiler

type Profiler struct {
	*v.Profiler
}

Profiler processes the version information, /proc/version, 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 kernel information from the /proc/version file as JSON serialized bytes.

func (*Profiler) Marshal

func (prof *Profiler) Marshal(k *v.Kernel) ([]byte, error)

Marshal is an alias for Serialize.

func (*Profiler) Serialize

func (prof *Profiler) Serialize(k *v.Kernel) ([]byte, error)

Serialize version.Kernel as JSON.

Source Files

Jump to

Keyboard shortcuts

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