A faster goimports implementation. It assumes that the files are part of a Go module and uses the information inside go.mod
to find the import paths for external dependencies.
go get -u github.com/blitzprog/autoimport/...
autoimport hello.go world.go
Work in progress (currently API only, CLI is not available yet).
importer := autoimport.New("/home/user/projects/helloworld")
Creates a new importer inside the given project directory. The root directory must have a go.mod
file. Otherwise it will traverse the directories going upwards until it finds a go.mod
file.
importer.Files([]string)
Work in progress. Automatically adds import statements to the given files.
importer.Source([]byte)
Work in progress.
Please take a look at the style guidelines if you'd like to make a pull request.
Cedric Fung | Scott Rayapoullé | Eduard Urbach |
Want to see your own name here?