utils

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandPath

func ExpandPath(path string) (string, error)

func ExpandPathPOSIX added in v0.19.0

func ExpandPathPOSIX(path string) (string, error)
Example
p, err := ExpandPathPOSIX("~/test")
if err != nil {
	log.Fatal(err)
}

_, last := filepath.Split(p)
fmt.Println(last)

p, _ = ExpandPathPOSIX("~NONEXISTINGUSER/path/to/file")
fmt.Println(p)

p, _ = ExpandPathPOSIX("/path/to/file/tilde/~")
fmt.Println(p)

p, _ = ExpandPathPOSIX("")
fmt.Println(p)

p, _ = ExpandPathPOSIX("")
fmt.Println(p)
Output:

test
~NONEXISTINGUSER/path/to/file
/path/to/file/tilde/~

func IntToUInt added in v0.19.0

func IntToUInt(i int) (uint, error)

IntToUInt safely converts an int to uint. Returns an error if the number is negative.

func IntToUInt64 added in v0.19.0

func IntToUInt64(i int) (uint64, error)

IntToUInt64 safely converts an int to uint64. Returns an error if the number is negative.

Types

This section is empty.

Jump to

Keyboard shortcuts

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