util

package
v0.0.0-...-f8034a1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const GoModFile = "go.mod"

Variables

View Source
var (
	ErrGoModNotFound = errors.New("can't locate go.mod")
)

Functions

This section is empty.

Types

type GoAstModification

type GoAstModification interface {
	//Selector select target node
	Selector(c *astutil.Cursor) bool
	// Action do action on selected node
	Action(c *astutil.Cursor) error
}

type GoAstModifier

type GoAstModifier struct {
	// contains filtered or unexported fields
}

func NewGoAstModifier

func NewGoAstModifier(file string) *GoAstModifier

func (*GoAstModifier) AddImport

func (gas *GoAstModifier) AddImport(p string)

func (*GoAstModifier) AddModification

func (gas *GoAstModifier) AddModification(actor ...GoAstModification)

func (*GoAstModifier) ParseAndModify

func (gas *GoAstModifier) ParseAndModify() (fset *token.FileSet, n ast.Node, err error)

type GoModMeta

type GoModMeta struct {
	// contains filtered or unexported fields
}

func ParseGoMod

func ParseGoMod(path string) (*GoModMeta, error)

func (*GoModMeta) Contains

func (gm *GoModMeta) Contains(module string) bool

func (*GoModMeta) GetAuthor

func (gm *GoModMeta) GetAuthor() string

func (*GoModMeta) GetProject

func (gm *GoModMeta) GetProject() string

Jump to

Keyboard shortcuts

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