util

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2017 License: MIT Imports: 7 Imported by: 50

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Atoi added in v0.9.0

func Atoi(s string) int

func GetExportedName added in v0.9.0

func GetExportedName(field string) string

func GroupsFromRegex added in v0.13.3

func GroupsFromRegex(rx, line string) map[string]string

GroupsFromRegex gets RegExp groups after matching it on a line

func InStrings

func InStrings(item string, items []string) bool

func IsAValidFunctionName added in v0.12.4

func IsAValidFunctionName(s string) bool

IsAValidFunctionName performs a check to see if a string would make a valid function name in Go. Go allows unicode characters, but C doesn't.

func NewBinaryExpr added in v0.11.0

func NewBinaryExpr(left goast.Expr, operator token.Token, right goast.Expr) *goast.BinaryExpr

func NewCallExpr added in v0.11.0

func NewCallExpr(functionName string, args ...goast.Expr) *goast.CallExpr

NewCallExpr creates a new *"go/ast".CallExpr with each of the arguments (after the function name) being each of the expressions that represent the individual arguments.

The function name is checked with IsAValidFunctionName and will panic if the function name is deemed to be not valid.

func NewExprStmt added in v0.11.3

func NewExprStmt(expr goast.Expr) *goast.ExprStmt

func NewFloatLit added in v0.13.2

func NewFloatLit(value float64) *goast.BasicLit

NewFloatLit creates a new Float Literal.

func NewFuncClosure added in v0.12.4

func NewFuncClosure(returnType string, stmts ...goast.Stmt) *goast.CallExpr

NewFuncClosure creates a new *"go/ast".CallExpr that calls a function literal closure. The first argument is the Go return type of the closure, and the remainder of the arguments are the statements of the closure body.

func NewIdent added in v0.11.0

func NewIdent(name string) *goast.Ident

func NewIdents added in v0.11.0

func NewIdents(names ...string) []goast.Expr

func NewIntLit added in v0.11.0

func NewIntLit(value int) *goast.BasicLit

func NewNil added in v0.12.0

func NewNil() *goast.Ident

func NewStringLit added in v0.11.0

func NewStringLit(value string) *goast.BasicLit

func NewTypeIdent added in v0.13.2

func NewTypeIdent(name string) goast.Expr

NewTypeIdent created a new Go identity that is to be used for a Go type. This is different from NewIdent in how the input string is validated.

func NewUnaryExpr added in v0.13.2

func NewUnaryExpr(operator token.Token, right goast.Expr) *goast.UnaryExpr

NewUnaryExpr creates a new Go unary expression. You should use this function instead of instantiating the UnaryExpr directly because this funtion has extra error checking.

func ShowDiff added in v0.11.1

func ShowDiff(a, b string) string

ShowDiff will print two strings vertically next to each other so that line differences are easier to read.

func Ucfirst

func Ucfirst(word string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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