returns

package
Version: v0.0.0-...-538ac60 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2018 License: BSD-3-Clause Imports: 13 Imported by: 4

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

Types

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.

Jump to

Keyboard shortcuts

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