blob: b20dc266b36e84e91304fad955793d2ca3ea268b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
gomove
===================
**gomove** is a utility to help you move golang packages by automatically changing the import paths from the old one to new one.
----------
**Warning: The current version of this tool will strip all the comments from the source code. It is a limitation with golang's ast parser and I am working on another implementation that will leave the comments as well.**
Getting Started
-------------
Getting started with gomove is really easy. If you have a proper `$GOPATH` setup and your path set to `bin` directory in `$GOPATH`, you can do the following to get gomove tool:
$ go get -u github.com/ksubedi/gomove
You can also download pre-built binary files and debian packages from the [releases page](https://github.com/KSubedi/gomove/releases).
Once you have the gomove installed, using it is really easy. First, move your package directory to the new directory and run gomove tool.
In this example, we are moving package `github.com/ksubedi/go-web-seed` to `github.com/ksubedi/new-project`. First we move the first directory to the second one, then we can do the following to automatically update the imports:
$ gomove -d $GOPATH/src/github.com/ksubedi/new-project github.com/ksubedi/go-web-seed github.com/ksubedi/new-project
You can also `cd` to the directory of `github.com/ksubedi/new-project` and run gomove like this:
$ gomove github.com/ksubedi/go-web-seed github.com/ksubedi/new-project
You can also only replace the contents one file only by using `-f` or `--file` flag.
$ gomove -f hello.go github.com/bla/bla github.com/foo/bar
You can also run `gomove --help` for help.
$ gomove --help
NAME:
gomove - Move Golang packages to a new path.
USAGE:
gomove command [command options] [old path] [new path]
VERSION:
0.0.1
AUTHOR(S):
Kaushal Subedi <kaushal@subedi.co>
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--dir, -d "./" directory to scan
--file, -f only move imports in a file
--help, -h show help
--version, -v print the version
License
-------------
This software is licensed under the GNU GPL V3 License. Check [LICENSE.md](LICENSE.md) for full license.
|