util

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildImport added in v1.4.1

func BuildImport(pkg string) string

func CloneSrc added in v1.4.3

func CloneSrc(dir, src string) error

func Error

func Error(msg string, args ...interface{})

func FileExist

func FileExist(file string) bool

func FindGoModFile added in v1.4.1

func FindGoModFile() (string, error)

func GetBeanFileName added in v1.4.0

func GetBeanFileName(bean interface{}) string

func GetBeanStructName added in v1.4.0

func GetBeanStructName(bean interface{}) string

func GetPkgName

func GetPkgName() (string, error)

func IsFileContains added in v1.4.0

func IsFileContains(sub string, openFile OpenFileHandler) (bool, error)

func MkDir

func MkDir(dir string) error

func OpenFile added in v1.4.0

func OpenFile(path string, mode int) (*os.File, error)

func OpenOrCreateFile added in v1.4.0

func OpenOrCreateFile(path string, mode int) (file *os.File, exists bool, err error)

func PipeOutput

func PipeOutput(cmd *exec.Cmd, pipe func(line []byte)) error

func ReadFile added in v1.4.0

func ReadFile(openFile OpenFileHandler) ([]byte, error)

func ReplaceFileContents added in v1.4.0

func ReplaceFileContents(oldString, newString string, n int, openFile OpenFileHandler) error

func Scan added in v1.4.1

func Scan(placeHolder string, ptr interface{}) error

func TemporaryEntry added in v1.4.0

func TemporaryEntry(dir string) (back func() error, err error)

func WriteFunction added in v1.4.0

func WriteFunction(fileName, receiver string, isPtr bool, structName, methodName, param, response string, annotation ...string) error

func WriteImports added in v1.4.0

func WriteImports(fileName string, imports []string) error

Types

type GoCmd

type GoCmd struct {
}

func (*GoCmd) Exec

func (g *GoCmd) Exec(args ...string) error

func (*GoCmd) ExecWithoutOutput added in v1.4.0

func (g *GoCmd) ExecWithoutOutput(args ...string) error

func (*GoCmd) Fmt

func (g *GoCmd) Fmt(paths ...string)

func (*GoCmd) FmtAll added in v1.4.0

func (g *GoCmd) FmtAll(dir ...string)

func (*GoCmd) Get added in v1.4.1

func (g *GoCmd) Get(pkg string)

func (*GoCmd) ModInit

func (g *GoCmd) ModInit(pkg string)

func (*GoCmd) ModTidy

func (g *GoCmd) ModTidy()

func (*GoCmd) Run added in v1.4.0

func (g *GoCmd) Run(file string)

type OpenFileHandler added in v1.4.0

type OpenFileHandler = func(mode int) (*os.File, error)

Jump to

Keyboard shortcuts

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