-
Notifications
You must be signed in to change notification settings - Fork 61
Description
This is minor, but curious whether you'd take a patch to grant users of the library control over import grouping.
Some organizations (including my own) tend to group imports beyond stdlib/non-stdlib. I've seen two permutations at different orgs:
- stdlib, public, private
- stdlib, public, private (shared), private (local)
goimports supports the former via its -local flag, such that:
import (
"net/http"
"github.com/public/pkg"
"github.com/private/pkg"
)when processed via goimports -local github.com/private will result in:
import (
"net/http"
"github.com/public/pkg"
"github.com/private/pkg"
)Further, goimports does not remove pre-existing groups.
I'd like dst's import management to provide the ability to retain the original grouping of imports - though this does introduce the problem of needing to find an appropriate place to insert any new imports that aren't stdlib.
Alternately, perhaps the best bet is to avoid using an import-aware FileRestorer and implement similar logic by hand.