format

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBytes

func FormatBytes(path string, data []byte, schema *Schema) ([]byte, error)

FormatBytes normalizes raw file contents according to the configured rules.

Types

type Result

type Result struct {
	Path    string
	Content []byte
	Changed bool
}

Result captures the outcome of formatting a file.

func FormatFile

func FormatFile(path string, schema *Schema) (*Result, error)

FormatFile loads a file, applies formatting rules, and returns the new body.

type Schema

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

Schema describes the canonical field ordering for an entity.

func NewSchema

func NewSchema(fields []*SchemaField) *Schema

NewSchema constructs a schema with the provided ordered fields.

type SchemaField

type SchemaField struct {
	Name     string
	Repeated bool
	Nested   *Schema
}

SchemaField represents a field entry and any nested schema for object properties.

Jump to

Keyboard shortcuts

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