Do go get a repository without updating his internal relationships.



  • When I do go get I need a repository (my separate repository), instead of just pulling up all the dependence, he's updating the versions of the negligible internal dependence of the repository that I'm pulling and downloading them. Such tamps, one day it breaks the assembly.

    How can I do that? go get Repository, without updating his internal ties? Or maybe there's an internal mechanism that will prevent the updating and downloading of inconsistent versions.



  • введите сюда описание изображения

    In this example, the main module depends on A 1.0 and B 2.1.
    Since B 2.1 is dependent on A 1.1, this version A will be used.
    and used A 1.1, and in turn it uses C 1.1.

    Final list of relationships:
    A 1.1
    B 2.1
    C 1.1

    Now you understand why go get or go mod tidy updating unnecessary dependence?
    You can try to use excluding or replace

    require (
        github.com/dep/one v1.0.0
        github.com/dep/two/v2 v2.3.0
        github.com/dep/other v0.0.0-20180523231146-b3f5c0f6e5f1
        github.com/dep/legacy v2.0.0+incompatible
    )
    

    exclude github.com/dep/legacy v1.9.2
    replace github.com/dep/one => github.com/fork/one

    exclude - prohibits the use of a certain version of the module
    replace - one module on another



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2