gofmt

Formats
Go
In ur.toml
[format.go] style = "gofmt"
Its options
https://pkg.go.dev/cmd/gofmt

Formatted

cart.go, as written
package cart

// What a cart costs.
type Item struct { Name string; Price int; Quantity int }
func Subtotal(items []Item) int {
    sum:=0
    for _,item:=range items { sum+=item.Price*item.Quantity }
    return sum
}
ur format --style gofmt cart.go
package cart

// What a cart costs.
type Item struct {
	Name     string
	Price    int
	Quantity int
}

func Subtotal(items []Item) int {
	sum := 0
	for _, item := range items {
		sum += item.Price * item.Quantity
	}
	return sum
}

Try it in the playground →

Defaults

The shared options, as gofmt sets them when nothing configures it. Its own names for them are read from its configuration files, but ur.toml sets them by the shared name only.

OptionDefaultgofmt calls it
width100
max-width
indent.width8
indent.style
line-ending"lf"
trailing-comma.add"preserve"
trailing-comma.forces-breakfalse
quotes"preserve"
target

Its own options

Set in a table named for it, such as [format.gofmt], or in a language's table, as gofmt = { ... }.

OptionDefaultWhat it does
sfalseSimplify the code where a shorter form means the same. Takes true or false.
r""Rewrite what matches a pattern before formatting, as pattern -> replacement. Takes a string.