Skip to content

Modules: Sub-Dependency is using v33, main project v35 - Type incompatibility + Module replacement #1859

@andygrunwald

Description

@andygrunwald

Hey everyone,
thanks for maintaining this library, keeping everything in shape, and continuously release new versions.
I am facing the challenge of using the new versions:

Sub-Dependency is using v33, main project v35 - Type incompatibility

Imagine Application A that is using

Independent of the breaking changes in versions (lets keep them out for now), when using both libraries, errors like

applicationA/file.go:129:89: cannot use listReposOpts (type *"github.com/google/go-github/v35/github".ListOptions) as type *"github.com/google/go-github/v33/github".ListOptions in argument to installationClient.Apps.ListRepos

What is the preferred way to solve this?

I can think of multiple solutions:

1) Updating dependency in sub-library
If the sub-library is from a different vendor/user, you don't have control over it and might lead to forking.

2) Cast the type v33/github".ListOptions to v35/github".ListOptions
This might work if the two types are the same. If this type is part of a breaking change, this might not work that simple and the code would be bloated with transferring the one type into another.

3) Module replacement
Here I am not sure. Is there a way on how Application A can force a module replacement for all other sublibraries?

This might not be an issue with the library itself, but rather to the usage.
However, I would like to get your thoughts on this and if you see a solution to this challenge.
Happy to provide further information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions