I'm curious how often you perform such refactoring? In my experience such changes are extremely rare and usually require other changes due to differences in the API of the two third-party packages . Which means, in my experience, expending effort to automate such import rewrites typically requires more effort than just doing it "by hand". The gomvpkg tool is meant to solve a more common problem that does happen with some regularity. Namely, changing the paths of packages private to a particular project as that project evolves. Which is why that tool "doesn't get the job done" for your situation.
On Sun, Oct 30, 2022 at 7:22 PM mr....@gmail.com <mr.i...@gmail.com> wrote: > He doesn't get the job done. > > 在2022年10月22日星期六 UTC+8 06:20:53<Amnon> 写道: > >> try https://pkg.go.dev/golang.org/x/tools/cmd/gomvpkg >> >> >> On Friday, 21 October 2022 at 16:58:57 UTC+1 mr....@gmail.com wrote: >> >>> I'm looking for a tool like this, I've searched google and github and >>> can't find one, have you guys used such a tool? >>> >>> I use a method like this in my code >>> >>> k8s.io/apimachinery/pkg/util/diff.ObjectReflectDiff >>> >>> k8s.io/apimachinery/pkg/util/diff is his import path, later I want to >>> switch to another method. >>> >>> github.com/google/go-cmp/cmp.Diff >>> >>> github.com/google/go-cmp/cmp is his import path. >>> >>> I would like to ask if there is a more convenient tool for replacing the >>> whole project? >>> >>> k8s.io/apimachinery/pkg/util/diff.ObjectReflectDiff -> >>> github.com/google/go-cmp/cmp.Diff >>> >> -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/695f32a0-009c-4415-b856-71bd4792385dn%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/695f32a0-009c-4415-b856-71bd4792385dn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD_eJ%2B-HLbJEQipjbNw77bAnhHCxP5i_t3xb%3D4NAFakHCw%40mail.gmail.com.