Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 864 Bytes

README.md

File metadata and controls

36 lines (27 loc) · 864 Bytes

Go Imports Order

Go Imports Order is a tool that prevents you from having imports out of order mantaing the company imports (the mod package) at the end of the file.

Installation

go install github.com/martinsaporiti/go-imports-order

Usage

./goimportsorder -pattern=github.com/mycompany/myproject ./...

Also you can analize the imports order of a single file:

./goimportsorder -pattern=github.com/mycompany/myproject ./myproject/myproject.go

Adding as private linter

Run this:

go build -buildmode=plugin -ldflags "-X plaugin.pattern=github.com/mycompany/myproject" plugin.go

then put this in your .golangci.yml:

  custom:
    importsorder:
      path: ./plugin.so
      description: The description of the linter
      original-url: https://github.com/martinsaporiti/goimportsorder