Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
/ nit Public archive

Opinionated code organization linter for Go projects.

License

Notifications You must be signed in to change notification settings

MarioCarrion/nit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nit

Go Report Card Circle CI coverage

I'm nitpicking your code.

What is this?

A really, really nitpicking linter that complains when the code is not organized according to the following very opinionated rules:

  1. imports is the first section
    • Requires parenthesized declaration,
    • One maximum,
    • Separated in 3 blocks: standard, external and same package (local).
  2. type is the second section
    • Requires parenthesized declaration,
    • Section must be sorted: exported first, then unexported.
  3. const is the third section
    • Requires parenthesized declaration,
    • Multiple allowed,
    • Section must be sorted: exported first, then unexported.
  4. var is the fourth section
    • Requires parenthesized declaration,
    • Section must be sorted: exported first, then unexported.
  5. func is the fifth section
    • Must be sorted, exported first, then unexported.
  6. func method, is the sixth section
    • Must be sorted by type, exported first, then unexported.

code

Development

  • Requires dep, you can use retool for installing that dependency.
  • goenv is used for versioning Go.