https://github.com/9d4/go-module-refactorizer
Refactor module imports in go project.
https://github.com/9d4/go-module-refactorizer
command-line-tool go go-module golang gomodule pyhton3 python python-script script
Last synced: 11 months ago
JSON representation
Refactor module imports in go project.
- Host: GitHub
- URL: https://github.com/9d4/go-module-refactorizer
- Owner: 9d4
- Created: 2022-03-03T08:59:35.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-03T09:14:51.000Z (almost 4 years ago)
- Last Synced: 2025-01-29T22:46:14.886Z (about 1 year ago)
- Topics: command-line-tool, go, go-module, golang, gomodule, pyhton3, python, python-script, script
- Language: Python
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-module-refactorizer
This tool is used to refactor module imports inside `.go` files in directory. See below.
Before:
```go
import (
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
"github.com/traperwaze/ampastelobot/action"
"github.com/traperwaze/ampastelobot/session"
)
```
After:
```go
import (
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
"github.com/9d4/ampastelobot/action"
"github.com/9d4/ampastelobot/session"
)
```
So, in demo above, I changed the `github.com/traperwaze` to `github.com/9d4`.
# Usage
I know this is the part you want to find the most. It's very simple to use this tool.
This tool is written in python. I've tested with python3, I don't know if it will work
with python2 or not, you may give it a try.
```shell
$ python3 main.py dir old_name new_name
```
Anything wrong? Don't hesitate to make issue or pull request.