utils

package
v0.0.0-...-ae53340 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendImports

func AppendImports(fSet *token.FileSet, astFile *ast.File, imp []string)

func BuildDependence

func BuildDependence(genGoFilePath, genExePath, genTxtPath, code string) error

BuildDependence store the path of the b001 file obtained by compiling the test code to TEMPDIR/b001.txt

func GetAstFileByFuncName

func GetAstFileByFuncName(searchPath, name string) (*ast.File, error)

func GetAstFileByStructName

func GetAstFileByStructName(searchPath, name string) (*ast.File, *ast.StructType, error)

func GetFunction

func GetFunction(funcName string, astFile *ast.File) *ast.FuncDecl

func GetGOPATH

func GetGOPATH() (gopath string, err error)

GetGOPATH returns the go path.

func GetImportPath

func GetImportPath(pkgName string, astFile *ast.File) (string, error)

func GoModTidy

func GoModTidy() error

func Hash

func Hash(s string) string

func KitexGen

func KitexGen(genHandler bool, goMod, idlPath, psm string) error

func MergeImportCfg

func MergeImportCfg(genTxtPath, originalCfg, cfg string, isCompilePhase bool) error

MergeImportCfg merge tempCfg into originalCfg. When it is the compile step, the cfg parameter should be `importcfg`. When it is the link step, the cfg parameter should be `importcfg.link`.

func PathExist

func PathExist(path string) (bool, error)

PathExist is used to judge whether the path exists in file system.

func ReplaceFuncBody

func ReplaceFuncBody(targetFunc *ast.FuncDecl, funcBody string)

func SearchGoMod

func SearchGoMod(cwd string, recurse bool) (moduleName, path string, found bool)

SearchGoMod searches go.mod from the given directory (which must be an absolute path) to the root directory. When the go.mod is found, its module name and path will be returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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