Go

- Files
.go- Formats as
- gofmt
- Lints
- Every rule that reads its code
- In
ur.toml [format.go]
Formatted
cart.go, as writtenpackage 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.gopackage 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
}
Versions
Ur reads Go as the profiles below name it. Name the versions a project targets in target; without it, Ur reads go-1.27.
| Profile | Dialect |
|---|---|
go-1.0 | Gc |
go-1.9 | Gc |
go-1.13 | Gc |
go-1.18 | Gc |
go-1.24 | Gc |
go-1.27 | Gc |