util

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecAt

func ExecAt(cmd *exec.Cmd, path string) ([]byte, error)

ExecAt runs the given Cmd with is working directory set to path.

func FileExists

func FileExists(path string, dir bool) (bool, error)

FileExists returns whether or not a file exists at the specified path. If dir is true, FileExists checks for the existence of the specified directory.

func FindFile

func FindFile(fileName string, dir bool) (string, error)

FindFile recursively searches upwards from the current directory to the filesystem root for the specified file.

func ReplaceLine

func ReplaceLine(filename, linePrefix, replacement string) (err error)

ReplaceLine replaces any line in the file at the given filename that begins with linePrefix with the given replacement string.

func WriteFile

func WriteFile(data []byte, path string, appendTo bool) error

WriteFile writes the given bytes to the file at path, creating one if necessary. If appendTo is true, then the data will be prepended to the top of the file.

func WriteJSON

func WriteJSON(data interface{}, root, dir, name string) error

WriteJSON marshals the given data as JSON and writes it to the specified location.

Types

This section is empty.

Jump to

Keyboard shortcuts

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