title: How the exclude directive works in the go.mod file?
body: <p>The new Go version 1.11 introduced the modules concept which is awesome.</p>
  
  <p>In the <a href="https://github.com/golang/go/wiki/Modules#gomod" rel="noreferrer">documentation</a> it says there are four directives that can be used in a <code>go.mod</code> file: <code>module</code>, <code>require</code>, <code>exclude</code>, <code>replace</code>.</p>
  
  <p>It also explains that:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>But I still don't understand how the <code>exclude</code> directive works.</p>
  
  <p>Can someone explain to me how the <code>exclude</code> directive works and if possible give an example of when to use it?</p>