Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best practices for forking? #1110

Open
ivoras opened this issue Jan 15, 2018 · 2 comments
Open

Best practices for forking? #1110

ivoras opened this issue Jan 15, 2018 · 2 comments

Comments

@ivoras
Copy link

ivoras commented Jan 15, 2018

Hello,

Btcd seems like it would be a good tool for experimenting with the Bitcoin's blockchain, and I'm wondering if you have any thoughts on how to properly fork it?

I've looked at the code and the btcd repo contains references to other repos in the github.com/btcsuite project, which is fine, but most of those have back-references to data structures in btcd, so they cannot be separated or exist as stand-alone. For example btcutil/address.go back-references github.com/btcsuite/btcd/btcec and github.com/btcsuite/btcd/chaincfg so it cannot really be used outside btcd, and there are a lot of such examples all over the place, probably for every single repo in btcsuite.

So it seems like all of those modules would need to also be forked, and their imports fixed, to have a working fork of btcd? Because if I just change the import paths in the btcd repo to not include "github.com/btcsuite/btcd/..." but "github.com/myfork/btcd/..." there are still all those other files from btcsuite repos which reference the original module (btcsuite/btcd) instead of the fork (myfork/btcd).

Any ideas?

@jrick
Copy link
Member

jrick commented Jan 15, 2018

Unless you are trying to create a derivative project, fork it on github, push to your fork, but keep the code under the canonical location in your GOPATH. If you want others to be able to build your changes, I would modify the README to include instructions for fetching or checking out your forked branch to the normal location.

This is just a limitation of workspace-based build systems like the go tool and there's nothing that can be done about this without moving to alternative tooling, e.g. gb.

@stijnmeijer
Copy link

stijnmeijer commented Apr 13, 2018

Having the same issue a week now. I indeed have to create a derivative project of btcd, as I need to test a slightly adjusted protocol. There seems to be no way to create a fork while keeping all dependencies intact.

EDIT: Found a way to do it. Stick with the glide.lock file that is provided here and in btcwallet. Fork all relevant repos. Note that the 'version' hashes in glide.lock will still point to previous versions. Rollback all repos to the version that is specified in the current glide.lock (by using the commit hashes). Now find-and-replace all imports to match your repo, and commit your changes to your own repos. Finally, update the version hashes in the glide.lock file to match with your last commit. This works 👍 @ivoras

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants