You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We often find ourselves using an upstream package which does most of what we need but not quite, so we decide to add a new feature to it and contribute the code upstream.
Before we can write any code we need to do some boring work:
• copy package path
• open browser
• paste URL
• fork package
• copy forked path
• go get fork path
• open go.mod
• add replace package path with canonical fork path
• now we can start editing
Would be nice to know if anyone found a smoother approach to easily contribute to upstream packages used in their codebase.
The text was updated successfully, but these errors were encountered:
I don't think opening the browser, pasting a URL and pressing the fork button needs to be split into separate bullet points. Those are minuscule tasks. The real task is to edit the go.mod. You don't need to open go.mod and add the replace path manually. Just use go mod edit -replace=old=new for that.
The set of tasks basically are -
fork the package
go mod edit -replace=old=new
Start building. (The updated go.mod will automatically fetch the new package)
To update your package, you need to git clone it obviously, but that is a separate workflow.
If/when your patch has been accepted upstream, just use go mod edit -dropreplace. I think this is smooth and simple. If you have any specific suggestions to improve this further, please feel free to open separate issues for those.
We often find ourselves using an upstream package which does most of what we need but not quite, so we decide to add a new feature to it and contribute the code upstream.
Before we can write any code we need to do some boring work:
• copy package path
• open browser
• paste URL
• fork package
• copy forked path
• go get fork path
• open go.mod
• add replace package path with canonical fork path
• now we can start editing
Would be nice to know if anyone found a smoother approach to easily contribute to upstream packages used in their codebase.
The text was updated successfully, but these errors were encountered: