undot
Remove dot imports from a go file.
installation
$ go install git.sr.ht/~nelsam/undot@latest
usage
To print to STDOUT
:
$ undot ./foo.go
To write back to the original file:
$ undot -w ./foo.go
but why though?
Dot imports have a lot of disadvantages with very few advantages. However, sometimes we come across packages
using them. The reasons vary (cyclic dependencies, moving code around too late, etc), but it happens.
Besides, this tool can be nice if you need to move functions/types out of a too-large package into their own
package. Move them, dot-import the old package, and run undot
.
examples
See the cases directory for some examples. These are test cases where each case has an
orig.go
file and an undot.go
file.