Skip to content
/ go-order Public

Go formatter for those who are strict about ordering

License

Notifications You must be signed in to change notification settings

td0m/go-order

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Go formatter for those who are strict about ordering

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages