Package returns implements a Go pretty-printer (like package "go/format") that also adds zero-value return values as necessary to incomplete return statements.



    This section is empty.


    This section is empty.


    func Process

    func Process(pkgDir, filename string, src []byte, opt *Options) ([]byte, error)

      Process formats and adjusts returns for the provided file in a package in pkgDir. If pkgDir is empty, the file is treated as a standalone fragment (opt.Fragment should be true). If opt is nil the defaults are used.


      type Options

      type Options struct {
      	Fragment bool // Accept fragment of a source file (no package statement)
      	PrintErrors bool // Print non-fatal typechecking errors to stderr (interferes with some tools that use gofmt/goimports and expect them to only print code or diffs to stdout + stderr)
      	AllErrors bool // Report all errors (not just the first 10 on different lines)
      	RemoveBareReturns bool // Remove bare returns

        Options specifies options for processing files.