Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wdullaer/go-import-manager
Programatically manipulate go import statements
https://github.com/wdullaer/go-import-manager
Last synced: about 1 month ago
JSON representation
Programatically manipulate go import statements
- Host: GitHub
- URL: https://github.com/wdullaer/go-import-manager
- Owner: wdullaer
- License: apache-2.0
- Created: 2017-12-11T10:33:00.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-23T13:51:21.000Z (over 6 years ago)
- Last Synced: 2024-06-21T14:29:49.898Z (5 months ago)
- Language: Go
- Size: 45.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Import Manager
Go Import Manager is a small cli tool which allows you to manipulate the import statements of a go file. Rather than relying on regex text replacements, it will parse and manipulate the AST of a file to do its job.
This is useful if you want to automate the build of an application that uses a [caddy](https://caddyserver.com) like plugin system.The latest binaries can be downloaded from the Github release pages.
## Usage
The application uses a docker style cli, with subcommands### List
**Options**
* *output, o*: The file to which the output will be written (default: stdout)**Example**
```bash
go-import-manager list main.go
```### Add
**Options**
* *output, o*: The file to which the output will be written (default: stdout)
* *inplace, i*: Set to edit the file in place**Example**
```bash
go-import-manager add main.go "fmt"
```### Delete
**Options**
* *output, o*: The file to which the output will be written (default: stdout)
* *inplace, i*: Set to edit the file in place**Example**
```bash
go-import-manager delete main.go "fmt"
```### Replace
**Options**
* *output, o*: The file to which the output will be written (default: stdout)
* *inplace, i*: Set to edit the file in place**Example**
```bash
go-import-mananager replace main.go "fmt" "github.com/foo/my-fmt"
```## Build
```bash
go get "github.com/wdullaer/go-import-manager"
```## TODO
* Add tests
* Add automated builds for more platforms## License
Apache-2.0 © [Wouter Dullaert](https://wdullaer.com)