pkg

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayTypeEqual

func ArrayTypeEqual(a, b *ast.ArrayType) error

func AssignStmtEqual

func AssignStmtEqual(a, b *ast.AssignStmt) error

func BasicLitEqual

func BasicLitEqual(a, b *ast.BasicLit) error

func BinaryExprEqual

func BinaryExprEqual(a, b *ast.BinaryExpr) error

func BlockStmtEqual

func BlockStmtEqual(a, b *ast.BlockStmt) error

func CallExprEqual

func CallExprEqual(a, b *ast.CallExpr) error

func CompositeLitEqual

func CompositeLitEqual(a, b *ast.CompositeLit) error

func DeclStmtEqual

func DeclStmtEqual(a, b *ast.DeclStmt) error

func ExprSliceEqual

func ExprSliceEqual(a, b []ast.Expr) error

func FieldListEqual

func FieldListEqual(a, b *ast.FieldList) error

func FieldListToMap

func FieldListToMap(fl *ast.FieldList) (map[string]Field, error)

func FuncDeclEqual

func FuncDeclEqual(a, b *ast.FuncDecl) error

func FuncTypeEqual

func FuncTypeEqual(a, b *ast.FuncType) error

func GenDeclEqual

func GenDeclEqual(a, b *ast.GenDecl) error

func IdentEqual

func IdentEqual(a, b *ast.Ident) error

func IfStmtEqual

func IfStmtEqual(a, b *ast.IfStmt) error

func IndexExprEqual

func IndexExprEqual(a, b *ast.IndexExpr) error

func InterfaceEqual

func InterfaceEqual(a, b *ast.InterfaceType) error

func KeyValueExprEqual

func KeyValueExprEqual(a, b *ast.KeyValueExpr) error

func LoadAstFile

func LoadAstFile(file string) (*ast.File, error)

func NodeEqual

func NodeEqual(a, b ast.Node) error

NodeEqual checks whether two nodes represent the same thing. If the are not the same, the first found mismatch will be reported. Comments and positions are ignored.

func RangeStmtEqual

func RangeStmtEqual(a, b *ast.RangeStmt) error

func RemoveDeclByName

func RemoveDeclByName(declarations []ast.Decl, name string) []ast.Decl

RemoveDeclByName removes a declaration by its name

func RemoveGenDeclByName

func RemoveGenDeclByName(declarations []ast.Decl, name string) []ast.Decl

RemoveGenDeclByName removes a const, var or type by its declaration name. References which use the declared thing are unchanged.

func RemoveImports

func RemoveImports(file *ast.File)

func RenameDeclarations

func RenameDeclarations(node ast.Node, oldName, newName string)

RenameDeclarations renames all occurrences of a declaration and their usage.

func ReturnStmtEqual

func ReturnStmtEqual(a, b *ast.ReturnStmt) error

func SelectorExprEqual

func SelectorExprEqual(a, b *ast.SelectorExpr) error

func StarExprEqual

func StarExprEqual(a, b *ast.StarExpr) error

func StructEqual

func StructEqual(a, b *ast.StructType) error

func TypeSpecEqual

func TypeSpecEqual(a, b *ast.TypeSpec) error

func UnaryExprEqual

func UnaryExprEqual(a, b *ast.UnaryExpr) error

func ValueEqual

func ValueEqual(a, b *ast.ValueSpec) error

func WriteAstFile

func WriteAstFile(file string, ast *ast.File) error

Types

type ErrAdditionalFields

type ErrAdditionalFields struct {
	A []string
	B []string
}

ErrAdditionalFields if a field list has additional fields

func (ErrAdditionalFields) Error

func (e ErrAdditionalFields) Error() string

type Field

type Field struct {
	Name string
	Tag  *ast.BasicLit
	Type ast.Expr
}

func (Field) ToAstField

func (f Field) ToAstField() *ast.Field

type Merger

type Merger struct {
	File ast.File
	// contains filtered or unexported fields
}

func NewMerger

func NewMerger(pkgName string) *Merger

func (*Merger) Merge

func (m *Merger) Merge(b *ast.File, duplicatePostfix string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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