utils

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommonBaseSearchPaths added in v0.0.10

func CommonBaseSearchPaths() []string

func CopyDir

func CopyDir(src string, dst string) (err error)

CopyDir will copy a directory and all contained files and directories. src must exist and dst must not exist. Permissions are preserved when possible. Symlinks are skipped.

func CopyFile

func CopyFile(src, dst string) (err error)

CopyFile will copy a file from src path to dst path. Overwrites any existing files at dst. Permissions are copied from file at src to the new file at dst.

func FindDir added in v0.0.10

func FindDir(dir string) (string, bool)

fileutils.FindDir looks for the given directory in nearby ancestors relative to the current working directory as well as the directory of the executable, falling back to `./` if not found.

func FindDirRelBinary added in v0.0.10

func FindDirRelBinary(dir string) (string, bool)

FindDirRelBinary looks for the given directory in nearby ancestors relative to the directory of the executable, then relative to the working directory, falling back to `./` if not found.

func FindFile added in v0.0.10

func FindFile(path string) string

FindFile looks for the given file in nearby ancestors relative to the current working directory as well as the directory of the executable.

func FindPath added in v0.0.10

func FindPath(path string, baseSearchPaths []string, filter func(os.FileInfo) bool) string

func HumanizeJSONError

func HumanizeJSONError(err error, data []byte) error

HumanizeJSONError extracts error offsets and annotates the error with useful context

func IsEmptyJSON

func IsEmptyJSON(j json.RawMessage) bool

func StringPtrToJSON

func StringPtrToJSON(ptr *string) json.RawMessage

Types

type HumanizedJSONError

type HumanizedJSONError struct {
	Err       error
	Line      int
	Character int
}

func NewHumanizedJSONError

func NewHumanizedJSONError(err error, data []byte, offset int64) *HumanizedJSONError

func (*HumanizedJSONError) Error

func (e *HumanizedJSONError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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