undot

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2023 License: MPL-2.0 Imports: 9 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL