Documentation
¶
Overview ¶
util is a package that contains common utility functions used across the application. This is a convenient place to put any function that interacts with the `types` or `ast` packages from the Go standard library. This package is also a good place to put any functions that are used in multiple places, and especially in multiple packages. This package should be kept as small as possible, and should not contain any functions that are specific to a single package. All exported functions must be documented in a way that is compatible with `godoc`.
Index ¶
- Constants
- func AssertExpressionEqual(a dst.Expr, b dst.Expr) bool
- func DebugPrint(node dst.Node) string
- func FunctionName(call *dst.CallExpr) string
- func IsBenchmark(pkg *decorator.Package, decl *dst.FuncDecl) bool
- func IsError(t types.Type) bool
- func IsGenerated(decorator *decorator.Decorator, file *dst.File) bool
- func IsTestPackage(pkg *decorator.Package) bool
- func IsUnderlyingType(underlyingType types.Type, name string) bool
- func IsUnitTest(pkg *decorator.Package, decl *dst.FuncDecl) bool
- func PackagePath(ident *dst.Ident, pkg *decorator.Package) string
- func Position(node dst.Node, pkg *decorator.Package) *token.Position
- func PrintNode(pkg *decorator.Package, node dst.Node) string
- func TypeOf(expr dst.Expr, pkg *decorator.Package) types.Type
- func WriteExpr(expr dst.Expr, pkg *decorator.Package) string
Constants ¶
const (
ErrorType = "error"
)
Variables ¶
This section is empty.
Functions ¶
func AssertExpressionEqual ¶
AssertExpressionEqual compares two dst.Expr and returns true if they are equal by recursively comparing their fields and values.
func DebugPrint ¶
DebugPrint returns a string representation of the given node. This is useful for debugging purposes, and will pretty print the structure of a node in human readable form.
Do Not Use: This function is only for debugging purposes.
func FunctionName ¶
FunctionName returns the name of the function being invoked in a call expression
func IsTestPackage ¶
func PackagePath ¶
PackagePath returns the package path of the ident according to go types info
func PrintNode ¶
PrintNode returns a string representation of the node as go code.
Warning: `gofmt` is applied to the output.
Types ¶
This section is empty.