Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 899 Bytes

README.md

File metadata and controls

43 lines (31 loc) · 899 Bytes

go-order

a Go formatter for those very particular about ordering.

Most of us who use Go like to structure their files in the following format:

  • package ...
  • import ...
  • const ...
  • var ...
  • type ...
  • func ...

This is exactly what go-order does! I originally implemented this idea in go-order.nvim, a Lua NeoVim extension that uses Treesitter. I wanted this to be more widely available to allow others who do not use Neovim to benefit from this, hence the rewrite.

Installation

To install, simply:

go install github.com/td0m/go-order@latest

Usage

To sort the file and print the output to stdout:

go-order -a < main.go

For help:

go-order -h

Roadmap

The following features are still in consideration:

  • sorting inside of const, var, and type blocks
  • sorting struct fields