akyoto / autoimport

A faster goimports implementation based on a go.mod resolver.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

autoimport

Godoc Report Tests Coverage Sponsor

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.

Installation

go get -u github.com/blitzprog/autoimport/...

CLI

autoimport hello.go world.go

Work in progress (currently API only, CLI is not available yet).

API

New

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.

Files

importer.Files([]string)

Work in progress. Automatically adds import statements to the given files.

Source

importer.Source([]byte)

Work in progress.

Style

Please take a look at the style guidelines if you'd like to make a pull request.

Sponsors

Cedric Fung Scott Rayapoullé Eduard Urbach
Cedric Fung Scott Rayapoullé Eduard Urbach

Want to see your own name here?

About

A faster goimports implementation based on a go.mod resolver.

License:MIT License


Languages

Language:Go 100.0%