commons

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseIO

func CloseIO(in io.Closer)

CloseIO will close the supplied closer and log the error.

func FileExists

func FileExists(filename string) bool

FileExists returns true if the filename exists and false otherwise.

func GetAllPackagesUnderDirectory

func GetAllPackagesUnderDirectory(pattern string) []string

GetAllPackagesUnderDirectory is like allPackages but is passed a pattern beginning ./ or ../, meaning it should scan the tree rooted at the given directory. There are sometimes ... in the pattern too.

func GetGoFiles

func GetGoFiles(filenames ...string) ([]string, error)

GetGoFiles returns all the go files from those files supplied

func GetGoFilesFromCurrentDir

func GetGoFilesFromCurrentDir() ([]string, error)

GetGoFilesFromCurrentDir returns all the Go files in the current dir

func GetGoFilesFromDir

func GetGoFilesFromDir(dirname string) ([]string, error)

GetGoFilesFromDir returns all the Go files in the supplied dir

func GetGoFilesFromDirectoryRecursive

func GetGoFilesFromDirectoryRecursive(dirname string) ([]string, error)

GetGoFilesFromDirectoryRecursive returns all the Go files from the supplied directory and it's children

func GetLineBoundary

func GetLineBoundary(source []byte, pos token.Pos) (int, int)

GetLineBoundary will return the start and end position of a line containing position pos NOTE: this method with panic if an invalid position is supplied

func GoFmt

func GoFmt(codeIn []byte) ([]byte, error)

GoFmt will format the supplied code using gofmt

func GoImports

func GoImports(fileName string, codeIn []byte) ([]byte, error)

GoImports will format the supplied code using goimports

func IsDir

func IsDir(filename string) bool

IsDir returns true if the filename is a directory and false otherwise.

func LogError

func LogError(format string, a ...interface{})

LogError will output the supplied log entry to stdErr. This is a wrapper around `fmt.Fprintf(os.Stderr, "") to appease lint checkers

Types

This section is empty.

Jump to

Keyboard shortcuts

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