go-quickfix: github.com/motemen/go-quickfix Index | Files | Directories

package quickfix

import "github.com/motemen/go-quickfix"

Package quickfix provides functions for fixing Go ASTs that are well typed but "go build" refuses to build.

Index

Package Files

quickfix.go

func QuickFix Uses

func QuickFix(fset *token.FileSet, files []*ast.File) (err error)

func RevertQuickFix Uses

func RevertQuickFix(fset *token.FileSet, files []*ast.File) error

type Config Uses

type Config struct {
    Fset     *token.FileSet
    Files    []*ast.File
    TypeInfo *types.Info
    MaxTries int
}

func (Config) QuickFix Uses

func (c Config) QuickFix() (err error)

QuickFix rewrites AST files of same package so that they pass go build. For example:

v declared but not used             -> append `_ = v`
"p" imported but not used           -> rewrite to `import _ "p"`
no new variables on left side of := -> rewrite `:=` to `=`

TODO implement hardMode, which removes errorneous code rather than adding

func (Config) QuickFixOnce Uses

func (c Config) QuickFixOnce() (bool, error)

func (Config) RevertQuickFix Uses

func (c Config) RevertQuickFix() (err error)

RevertQuickFix reverts possible quickfixes introduced by QuickFix. This may result to non-buildable source, and cannot reproduce the original code before prior QuickFix. For example:

`_ = v`        -> removed
`import _ "p"` -> rewritten to `import "p"`

type ErrCouldNotLocate Uses

type ErrCouldNotLocate struct {
    Err  types.Error
    Fset *token.FileSet
}

func (ErrCouldNotLocate) Error Uses

func (e ErrCouldNotLocate) Error() string

type ErrorList Uses

type ErrorList []error

func (ErrorList) Error Uses

func (errs ErrorList) Error() string

Directories

PathSynopsis
cmd/goquickfixThe goquickfix command quick fixes Go source that is well typed but go refuses to compile e.g.

Package quickfix imports 8 packages (graph) and is imported by 6 packages. Updated 2016-07-20. Refresh now. Tools for package owners.