https://github.com/akyoto/autoimport
A faster goimports implementation based on a go.mod resolver.
https://github.com/akyoto/autoimport
Last synced: 5 days ago
JSON representation
A faster goimports implementation based on a go.mod resolver.
- Host: GitHub
- URL: https://github.com/akyoto/autoimport
- Owner: akyoto
- License: mit
- Created: 2018-04-27T16:21:02.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-26T04:19:45.000Z (over 5 years ago)
- Last Synced: 2025-03-22T16:50:36.447Z (4 months ago)
- Language: Go
- Homepage:
- Size: 81.1 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# autoimport
[![Godoc][godoc-image]][godoc-url]
[![Report][report-image]][report-url]
[![Tests][tests-image]][tests-url]
[![Coverage][coverage-image]][coverage-url]
[![Sponsor][sponsor-image]][sponsor-url]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
```shell
go get -u github.com/blitzprog/autoimport/...
```## CLI
```bash
autoimport hello.go world.go
```Work in progress (currently API only, CLI is not available yet).
## API
### New
```go
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
```go
importer.Files([]string)
```Work in progress. Automatically adds import statements to the given files.
### Source
```go
importer.Source([]byte)
```Work in progress.
## Style
Please take a look at the [style guidelines](https://github.com/akyoto/quality/blob/master/STYLE.md) if you'd like to make a pull request.
## Sponsors
| [](https://github.com/cedricfung) | [](https://github.com/soulcramer) | [](https://twitter.com/eduardurbach) |
| --- | --- | --- |
| [Cedric Fung](https://github.com/cedricfung) | [Scott Rayapoullé](https://github.com/soulcramer) | [Eduard Urbach](https://eduardurbach.com) |Want to see [your own name here?](https://github.com/users/akyoto/sponsorship)
[godoc-image]: https://godoc.org/github.com/blitzprog/autoimport?status.svg
[godoc-url]: https://godoc.org/github.com/blitzprog/autoimport
[report-image]: https://goreportcard.com/badge/github.com/blitzprog/autoimport
[report-url]: https://goreportcard.com/report/github.com/blitzprog/autoimport
[tests-image]: https://cloud.drone.io/api/badges/blitzprog/autoimport/status.svg
[tests-url]: https://cloud.drone.io/blitzprog/autoimport
[coverage-image]: https://codecov.io/gh/blitzprog/autoimport/graph/badge.svg
[coverage-url]: https://codecov.io/gh/blitzprog/autoimport
[sponsor-image]: https://img.shields.io/badge/github-donate-green.svg
[sponsor-url]: https://github.com/users/akyoto/sponsorship