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.
go install github.com/martinsaporiti/go-imports-order
./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
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