goreturns: github.com/sqs/goreturns/returns Index | Files

package returns

import "github.com/sqs/goreturns/returns"

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

Index

Package Files

fix.go index.go returns.go

func Process Uses

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 Uses

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.

Package returns imports 13 packages (graph) and is imported by 5 packages. Updated 2018-12-18. Refresh now. Tools for package owners.