I doubt you’ll like this answer but the one way i know we’ll work is if you fork the repository, bump the version, and then replace the dep with your fork.
Joe On Monday, April 14, 2025 at 8:37:15 AM UTC-5 twp...@gmail.com wrote: > Hello, > > My project uses github.com/google/go-github/v71 and one of its > dependencies uses an earlier major version of the same module, > github.com/google/go-github/v61. Consequently, the compiled binary > contains both major versions of go-github, which bloats the binary by about > 2MB. > > Is there a way to use only the most recent major version? > > I tried (in go.mod): > > replace github.com/google/go-github/v61 v61.0.0 => > github.com/google/go-github/v71 v71.0.0 > > but running go mod tidy then gives the error: > > go: github.com/google/go-github/v...@v71.0.0 > <http://github.com/google/go-github/v71@v71.0.0> used for two different > module paths (github.com/google/go-github/v61 and > github.com/google/go-github/v71) > > For the full code of the attempt, see this draft PR > <https://github.com/twpayne/chezmoi/pull/4403>. > > Background info: > * github.com/google/go-github seems to bump its major version every > couple of weeks, even when it does not break backwards compatibility. > * I can use the same old version (v61) in my project as in the dependency, > but I'd like to keep my project's dependencies up to date. > * I could submit a PR to the dependency to update it to use the latest > major version of github.com/google/go-github, but because > google/go-github bumps major versions so often, this is not a sustainable > long term solution. > > So, is there an incantation that I can add to my go.mod to force a > dependency to use a newer major version of a module? > > Thank you for any insight, > Tom > -- 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. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/5d2a7b18-bf10-42d6-b24d-3e361aec4881n%40googlegroups.com.