ksubedi / gomove Goto Github PK
View Code? Open in Web Editor NEWgomove is a utility to help you move golang packages by automatically changing the import paths from the old one to new one.
License: Other
gomove is a utility to help you move golang packages by automatically changing the import paths from the old one to new one.
License: Other
Alter behaviour to be consistent with go builtin ./... (go list ./... etc) and skip/ignore code under vendor/
folders.
alex@MacBook-Pro ~/c/ratchet (develop) [127]> go get -u github.com/ksubedi/gomove
go: finding github.com/ksubedi/gomove latest
go: downloading github.com/ksubedi/gomove v0.0.0-20181214015902-9efbee930b0e
go: extracting github.com/ksubedi/gomove v0.0.0-20181214015902-9efbee930b0e
go: finding golang.org/x/tools latest
go: downloading golang.org/x/tools v0.0.0-20191120001058-ad01d5993d97
go: finding github.com/mgutz/ansi latest
go: finding github.com/codegangsta/cli v1.22.1
go: downloading github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
go: extracting github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
go: downloading github.com/codegangsta/cli v1.22.1
go: extracting golang.org/x/tools v0.0.0-20191120001058-ad01d5993d97
go: extracting github.com/codegangsta/cli v1.22.1
go: github.com/ksubedi/gomove imports
github.com/codegangsta/cli: github.com/codegangsta/[email protected]: parsing go.mod:
module declares its path as: github.com/urfave/cli
but was required as: github.com/codegangsta/cli
alex@MacBook-Pro ~> go get -u github.com/ksubedi/gomove
# github.com/ksubedi/gomove
go/src/github.com/ksubedi/gomove/main.go:18:5: app.Author undefined (type *cli.App has no field or method Author)
go/src/github.com/ksubedi/gomove/main.go:21:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
go/src/github.com/ksubedi/gomove/main.go:26:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
go/src/github.com/ksubedi/gomove/main.go:30:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
go/src/github.com/ksubedi/gomove/main.go:37:13: cannot use func literal (type func(*cli.Context)) as type cli.ActionFunc in assignment
Just tested this out and the files that actually changed also had code comments stripped out.
When I try to install this package I get the following error:
go: github.com/KSubedi/gomove@latest: github.com/KSubedi/[email protected]: parsing go.mod:
module declares its path as: github.com/ksubedi/gomove
but was required as: github.com/KSubedi/gomove
I've tried with a bunch of different Go versions:
$ go1.13.15 get -u github.com/KSubedi/gomove
go: finding github.com/KSubedi/gomove latest
go get: github.com/KSubedi/[email protected]: parsing go.mod:
module declares its path as: github.com/ksubedi/gomove
but was required as: github.com/KSubedi/gomove
$ go1.18.3 install github.com/KSubedi/gomove@latest
go: github.com/KSubedi/gomove@latest: github.com/KSubedi/[email protected]: parsing go.mod:
module declares its path as: github.com/ksubedi/gomove
but was required as: github.com/KSubedi/gomove
$ go1.20 install github.com/KSubedi/gomove@latest
go: github.com/KSubedi/gomove@latest: github.com/KSubedi/[email protected]: parsing go.mod:
module declares its path as: github.com/ksubedi/gomove
but was required as: github.com/KSubedi/gomove
Seems like the case of the module declaration in go.mod needs to be fixed.
Thanks for a great tool!
In using it for golang.org/x/tools
, I found gomove
missed imports that use an explicit package name:
import _ "a/package/name1" // side-effects-only import
import myname "a/package/name2" // imported as myname
// Alternatively...
import (
"an/unrelated/package"
_ "a/package/name1"
myname "a/package/name2"
)
It'd be nice (especially if migrating a project between orgs) to be able to run gomove
and have it change the go.mod if necessary.
Not sure if this should be an optional thing, or something you explicitly don't want.
Basically, I'm thinking that running gomove github.com/myorg/my-repo github.com/neworg/my-repo
would patch all the Go files, and also, update the module too (unless otherwise requested).
module github.com/myorg/my-repo => module github.com/neworg/my-repo
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.