[go-nuts] Re: Dangers of package renaming

2017-12-05 Thread Tim Peoples

You may want to consider using a type alias -- similar to how 
golang.org/x/net/context  
is being transitioned to the standard library's context 
 package.

Also, Russ Cox wrote an excellent article about codebase refactoring 
; I highly recommend it.


On Saturday, December 2, 2017 at 7:33:06 AM UTC-8, Jonathan Hall wrote:
>
> I maintain an open-source Go package with a few dozen followers.  (
> github.com/flimzy/kivik)
>
> I'm planning to transfer/rename the package to a new organization (new 
> package name to be: github.com/go-kivik/kivik).
>
> I understand that GitHub will maintain a redirect from the old location to 
> the new one, so in theory, old imports will continue working.
>
> But my question is: Are there any dangers I need to consider when making 
> this change, and is there anything I can do to help mitigate such dangers?  
> I ask mainly because I've read of some nightmares related to package 
> renaming (example: 
> https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276), 
> and want to do everything possible to prevent such problems for my own 
> package.  (To be clear: I don't think the Sirupsen problem in particular 
> will affect me, since it's not just a capitalization change).
>
> Keep in mind that the package has sub-packages as a dependencies (i.e. 
> github.com/flimzy/kivik dependson github.com/flimzy/kivik/errors), in 
> case this complicates things.
>
> Thank you,
>
> Jonathan
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Dangers of package renaming

2017-12-03 Thread Jonathan Hall
Thanks for the reply.  Those are some good considerations.

I'm not excited about retaining a "stub" package in the old location.  I'd 
rather that just redirect, rather than creating two packages.  The 
two-package approach may solve a short-term pain, but I fear it may 
increase long-term confusion.

I wonder what you, or others, would think of using another approach: 
Setting an import comment to the old path, until a version bump.

In other words, I would add import comments to all of the existing packages:

package kivik // import "github.com/flimzy/kivik"

Then I would transfer the package to the new group, keeping the import 
comments in place.  All consumers of the library would therefore be 
required to use the old import path.

At some point in the (near) future, I'd bump the version to 2.0.0, along 
with a renaming of all import paths to:

package kivik // import "github.com/go-kivik/kivik"

The 2.0.0 switch will involve other breaking changes, so this would bundle 
all breaking changes together, while continuing to work for the old import 
path for older versions.

This approach of course assumes that consumers of the library are using a 
vendoring tool with semver support, but this is an assumption I'm willing 
to live with.

Any drawbacks I'm not seeing with this approach?

-- Jonathan

On Saturday, December 2, 2017 at 4:33:06 PM UTC+1, Jonathan Hall wrote:
>
> I maintain an open-source Go package with a few dozen followers.  (
> github.com/flimzy/kivik)
>
> I'm planning to transfer/rename the package to a new organization (new 
> package name to be: github.com/go-kivik/kivik).
>
> I understand that GitHub will maintain a redirect from the old location to 
> the new one, so in theory, old imports will continue working.
>
> But my question is: Are there any dangers I need to consider when making 
> this change, and is there anything I can do to help mitigate such dangers?  
> I ask mainly because I've read of some nightmares related to package 
> renaming (example: 
> https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276), 
> and want to do everything possible to prevent such problems for my own 
> package.  (To be clear: I don't think the Sirupsen problem in particular 
> will affect me, since it's not just a capitalization change).
>
> Keep in mind that the package has sub-packages as a dependencies (i.e. 
> github.com/flimzy/kivik dependson github.com/flimzy/kivik/errors), in 
> case this complicates things.
>
> Thank you,
>
> Jonathan
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.