Modify vendored code?

I have a project using google/gopacket (which is vendored in the project).
We needed a slight change to gopacket so we modified the vendored code, just to get things to work.

I’m assume that modifying vendored code is not such a good idea?
Is there a best practice that people use instead?

I realize a pull-request would probably be the ideal solution, but I’d like to understand what to do when that is not an option.

You can modify vendored code, but its possible tooling will overwrite your changes. What I do in these cases is to use a local copy of the repo and a replace directive, at least for development purposes. If the need it longer term I fork the project and use a replace directive to point at my fork while the upstream is considering a PR.

You can create a fork.

Creating a fork and using the replace directive worked great. Thanks for the help!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.