Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akyoto/autoimport
A faster goimports implementation based on a go.mod resolver.
https://github.com/akyoto/autoimport
Last synced: about 23 hours 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 (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-26T04:19:45.000Z (about 5 years ago)
- Last Synced: 2024-06-21T16:58:57.232Z (5 months ago)
- Language: Go
- Homepage:
- Size: 81.1 KB
- Stars: 4
- Watchers: 3
- 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
| [![Cedric Fung](https://avatars3.githubusercontent.com/u/2269238?s=70&v=4)](https://github.com/cedricfung) | [![Scott Rayapoullé](https://avatars3.githubusercontent.com/u/11772084?s=70&v=4)](https://github.com/soulcramer) | [![Eduard Urbach](https://avatars3.githubusercontent.com/u/438936?s=70&v=4)](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