You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sorted is a linter and formatter used to maintain consistent sorting across
various structures.
At the moment it only supports alphabetic sorting in const, var and
struct blocks, but we're aiming to support any kind of sortable or
order-related structures like generics, func in/out arguments and more.
So what's working?
It can be generalized into 2 main categories for now, that are
Blocks
const ( // or varB=iota// B, A are not sorted alphabeticallyA
)
Multiple sections treated as such
const ( // or varB=iota// B, A are not sorted alphabeticallyAC// okDZ// Z, Y are not sorted alphabeticallyYX
)
Multiple inline identifiers
constc, b, a=0, 0, 0// single line idents are not sorted alphabetically
These checks are working for const, var, struct blocks.
TODO
const, var
Blocks
Alphabetical sorting
Auto Fix
Inline
Alphabetical sorting
Auto Fix
struct
Alphabetical sorting
Auto Fix
//sorted:ignore comment
TODO later
in order of most importance
golangci-lint integration
switch only for basic type values (string, int, ...)
imports (pretty much what gci does with some more)
func
Alphabetical sorting
Public/Private sorting
New* func order
Generics
About
Go linter that makes your code alphabetically sorted