util

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 6 Imported by: 22

Documentation

Index

Constants

View Source
const (
	UNKNOWN = "unknown"
)

Variables

This section is empty.

Functions

func ConcatStrings added in v0.9.0

func ConcatStrings(items ...string) string

ConcatStrings concatenate strings in a larger one. This function addresses a very specific ghw use case. For a more general approach, just use strings.Join()

func ParseBool added in v0.11.0

func ParseBool(str string) (bool, error)

Convert strings to bool using strconv.ParseBool() when recognized, otherwise use map lookup to convert strings like "Yes" "No" "On" "Off" to bool `ethtool` uses on, off, yes, no (upper and lower case) rather than true and false.

func SafeClose

func SafeClose(c closer)

func SafeIntFromFile

func SafeIntFromFile(ctx *context.Context, path string) int

Reads a supplied filepath and converts the contents to an integer. Returns -1 if there were file permissions or existence errors or if the contents could not be successfully converted to an integer. In any error, a warning message is printed to STDERR and -1 is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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