The new Go version 1.11 introduced the modules concept which is awesome.
In the documentation it says there are four directives that can be used in a go.mod
file: module
, require
, exclude
, replace
.
It also explains that:
exclude and replace directives only operate on the current (“main”) module. exclude and replace directives in modules other than the main module are ignored when building the main module. The replace and exclude statements therefore allow the main module complete control over its own build, without also being subject to complete control by dependencies.
But I still don't understand how the exclude
directive works.
Can someone explain to me how the exclude
directive works and if possible give an example of when to use it?