godo

package
v0.0.0-...-50fe65b Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EXIT_OK  = 0 // Zero exit code
	EXIT_BAD = 1 // General error exit code
)

Variables

View Source
var WorkDirStack = []string{}

WorkDirStack is the working directory stack used by Pushd and Popd functions.

Functions

func CD

func CD(dir string) error

CD is an alias for os.Chdir.

func CopyFile

func CopyFile(src, dst string, overwrite bool) error

CopyFile copies the single file 'src' to 'dst'.

func FileExists

func FileExists(f string) (bool, error)

FileExists returns true if the file exists, false if not, and an error if file existence could not be determined.

func IsDir

func IsDir(f string) (bool, error)

IsDir returns true if the file exists and is a directory. An error is returned if this could not be determined.

func IsRegFile

func IsRegFile(f string) (bool, error)

IsRegFile returns true if the file exists and is a regular file. An error is returned if this could not be determined.

func NoCheckCopyFile

func NoCheckCopyFile(src, dst string) error

NoCheckCopyFile copies the single file 'src' to 'dst' and doesn't make any attempt to check the file paths before hand.

func Panik

func Panik(e error, m string, args ...interface{})

Panik prints the error before exiting with code 1. It does not generate a Go panic but simulates one without propagation or printing the call stack, sorry for any confusion. Wraps 'e' with another error containing the format message 'm' if 'm' is not empty.

func Popd

func Popd() error

Popd emulates the popd bash functionality.

func Pushd

func Pushd(dir string) error

Pushd emulates pushd bash functionality.

func RemoveDir

func RemoveDir(dir string) (bool, error)

RemoveDir recursively removes directory 'dir'. If something was removed then true is returned rather than an error.

func Run

func Run(exePath string, workDir string, args ...string) (int, error)

Run runs the executable at 'exePath'. Setting the 'workDir' as empty will use the default as specified by functions that accept exec.Cmd. EXIT_OK is returned on successful execution otherwise EXIT_BAD or another non-zero exit code is returned.

func SameFile

func SameFile(a, b string) (bool, error)

SameFile returns true if the two files 'a' and 'b' describe the same files as determined by os.SameFile. An error is returned if the file info could not be retreived for either file.

func Wrap

func Wrap(e error, m string, args ...interface{}) error

Wrap wraps an error 'e' with a another message 'm'.

Types

type Go

type Go struct {
	Path    string
	WorkDir string
}

Go represents a wrapper to the Go compiler. Functionality is provided for building, formatting, and testing.

func NewGo

func NewGo(workDir string) (Go, error)

NewGo returns a new Go struct. 'workDir' may be empty to signify the current working directory should be used.

func (Go) Build

func (g Go) Build(dir, flags, pkg string) error

func (Go) Fmt

func (g Go) Fmt(pkg string) error

func (Go) FmtAll

func (g Go) FmtAll() error

func (Go) NewCmd

func (g Go) NewCmd(args ...string) *exec.Cmd

func (Go) Test

func (g Go) Test(pkg string, timeout string) error

func (Go) TestAll

func (g Go) TestAll(timeout string) error

Jump to

Keyboard shortcuts

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