Discover Packages
github.com/sirkon/go-imports-rename
command
module
Version:
v0.1.3
Opens a new window with list of versions in this module.
Published: Feb 27, 2022
License: MIT
Opens a new window with license information.
Imports: 17
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
go-imports-rename
Tool to change import paths
Important case
Important case is to append suffix to existing path, i.e. to grow gitlab.example.com/common/utils
into gitlab.example.com/common/utils/v2
use
go-imports-rename 'gitlab.example.com/common/utils/ ++'
to grow gitlab.example.com/common/utils/package
into gitlab.example.com/common/utils/v2/package
Usage examples
Simple usage. Please do not use it for import paths upgrade from version below 2. Use ++
operator instead.
go-imports-rename 'github.com/rsz/ => github.com/rs/'
will list all possible import path changes with given prefix github.com/rsz/
in Go files in current directory and
all its subdirectories. No saves will be done.
Use --save
flag to commit these changes:
go-imports-rename --save 'github.com/rsz/ => github.com/rs/'
Use --root
flag to diagnose or make changes in specific directory:
go-imports-rename --root $GOPATH/src 'github.com/rsz/ => github.com/rs/'
Will diagnose changes in $GOPATH/src
There is a shortcut for the fresh v1.x.y ⇒ v2.α.β migrations:
go-imports-rename 'github.com/user/project ++'
It is an equivalent for
go-imports-rename 'github.com/user/project/ => github.com/user/project/v2/'
In this case the utility takes care of paths and will not replace github.com/user/projectNext
. Also,
github.com/user/project/v2
won't change.
You can also move from v2
to v3
in the same way
go-imports-rename 'github.com/user/project/v2 ++'
You can jump through several migrations:
go-imports-rename 'github.com/user/project += 5'
It is an equivalent for
go-imports-rename 'github.com/user/project/ => github.com/user/project/v6'
Use //
operator to imports rename with regular expression
go-imports-rename '^gen/(.*)$ // gitlab.example.com/common/schema/$1'
will diagnose possible gen/common
and similar imports changes into gitlab.example.com/common/schema/common
, etc
Expand ▾
Collapse ▴
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
internal
Click to show internal directories.
Click to hide internal directories.