How you deal with bugfixes in imported packages?

Curious about what processes gophers are using on real world projects when they need to patch something they’re importing, while waiting for that patch to be accepted.

Today I was doing some experimentation on go-dbus-keyring and realized that when I tested my keychain program on different computers, sometimes it was failing. Ultimately a bit of debugging and a small patch to the imported library and I was able to fix it.

While working with it on your own development system, the go.mod replace makes it very easy to customize the code of any import. I don’t think there’s any downside of using go mod init on every a trivial dozen line program when you need to patch an import.

module keychain

go 1.13

require ( v5.0.3 v1.0.1

replace => ./go-dbus-keyring

/Vendor is also an option…

Curious what other solutions there are for patching imports, and what gophers recommend for real life situations?