github.com/dop251/modtools@v0.0.0-20220314120634-3b2fc95d1790/README.md (about)

     1  modtools - Keep your go.mod dependencies up-to-date.
     2  ====
     3  
     4  modtools is a command-line toolset designed to help keeping the go.mod dependencies up-to-date while still allowing exceptions.
     5  
     6  Why?
     7  ---
     8  
     9  Dependency pinning has its obvious advantages: for a project with dozens of dependencies you don't want your
    10  build to break unpredictably due to a change in one of them. The flip side is that dependencies tend to become
    11  stale. The changes within the same major version should maintain compatibility and in most cases they don't actually
    12  break anything, but instead provide new features, bugfixes and security updates. That's why upgrading should be
    13  done on a regular basis.
    14  
    15  Modtools is designed to make the process of upgrading dependencies easier. Running `modtools check` shows the list
    16  of direct and indirect dependencies that can be upgraded. It prints the list of commands that need to be run and
    17  exits with a non-zero code if such dependencies exist:
    18  
    19  ```console
    20  $ go install github.com/dop251/modtools@latest
    21  $ modtools check
    22  Some dependencies are out-of-date. Please upgrade by running 'modtools update' or the following commands:
    23  
    24  go get github.com/kr/pretty@v0.2.1
    25  go get github.com/kr/text@v0.2.0
    26  go get gopkg.in/check.v1@v1.0.0-20201130134442-10cb98267c6c
    27  
    28  Error: check has failed
    29  ```
    30  
    31  This command could be added to a CI pipeline running on a schedule or to a commit hook.
    32  
    33  In case a new version of a dependency causes a problem it can be added to the exception list by running
    34  `modtools freeze modpath` so that it's ignored for up to the specified number of days:
    35  
    36  ```console
    37  $ modtools freeze gopkg.in/check.v1 14
    38  Don't forget to add modtools_frozen.yml to the repository.
    39  ```
    40  
    41  During this time the necessary adjustments need to be made to accommodate for the change (if it was deliberate),
    42  or a bug report should be raised if it wasn't. When the problem is fixed
    43  `modtools thaw modpath` can be used to remove `modpath` from the list of exceptions.
    44