imports

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyPaths       = errors.New("empty paths")
	ErrNotGoFile        = errors.New("not go file")
	ErrGoGeneratedFile  = errors.New("go generated file")
	ErrAlreadyFormatted = errors.New("already formatted")
	ErrEmptyImport      = errors.New("empty import")
	ErrGoModNotExist    = errors.New("go mod not exist")
	ErrGoModEmptyModule = errors.New("go mod empty module")
	ErrNotBytesBuffer   = errors.New("not bytes.Buffer")
	ErrNotDSTGenDecl    = errors.New("not dst.GenDecl")
)

Functions

This section is empty.

Types

type Formatter

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

stdPackages -> save std packages for later search. moduleNames -> map path to its go.mod module name. formattedPaths -> make sure we not format path more than 1 time.

func NewFormmater

func NewFormmater(opts ...FormatterOptionFn) (*Formatter, error)

func (*Formatter) Format

func (ft *Formatter) Format(paths ...string) error

Accept a list of files or directories

type FormatterOptionFn

type FormatterOptionFn func(*Formatter)

func FormatterWithCompanyPrefix

func FormatterWithCompanyPrefix(companyPrefix string) FormatterOptionFn

func FormatterWithDiff

func FormatterWithDiff(isDiff bool) FormatterOptionFn

func FormatterWithList

func FormatterWithList(isList bool) FormatterOptionFn

func FormatterWithStock added in v0.0.9

func FormatterWithStock(isStock bool) FormatterOptionFn

func FormatterWithVerbose

func FormatterWithVerbose(isVerbose bool) FormatterOptionFn

func FormatterWithWrite

func FormatterWithWrite(isWrite bool) FormatterOptionFn

Jump to

Keyboard shortcuts

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