format

package
v0.0.0-...-33caf10 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package format provides unified Go formatting. It combines: import fixing, line shortening, and gofumpt-style rules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

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

Formatter performs unified Go formatting.

func New

func New(opts Options) *Formatter

New creates a new formatter.

func (*Formatter) Format

func (f *Formatter) Format(filename string, src []byte) ([]byte, error)

Format formats source. Returns formatted output or an error if the source is not valid Go.

type Options

type Options struct {
	LineLength    int      // target maximum line length (default: 100)
	TabWidth      int      // tab display width (default: 4)
	ModulePath    string   // module path for import grouping
	LocalPrefixes []string // local import prefixes for grouping
	Fast          bool     // skip sibling scan for import resolution
	Resolve       bool     // load full type info for third-party import resolution
}

Options configures the formatter.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns sensible defaults.

Jump to

Keyboard shortcuts

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