title: What does "inconsistent vendoring" mean in Go?
body: <p>I'm getting this inconsistent vendoring error and I'm a total Go newbie. Can anyone explain to me how go.mod interacts with vendor/modules.txt? I found <a href="https://stackoverflow.com/questions/35109393/what-does-vendoring-mean-in-go">this question</a> helpful, and now I'm wondering if I should even have a vendor directory. Would that be created by running <code>go mod vendor</code>? I inherited this project and it already has the vendor directory in git.</p>
  <p>Here's the relevant part of my go.mod file -</p>
  <pre><code>module mymodule
  
  go 1.17
  
  require (
          gopkg.in/redis.v5 v5.2.9
  )
  </code></pre>
  <p>And then the related error message:</p>
  <pre><code>go: inconsistent vendoring
  gopkg.in/redis.v5@v5.2.9: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
  </code></pre>
  <p>In vendor/modules.txt I have:</p>
  <pre><code>#gopkg.in/redis.v5 v5.2.9
  gopkg.in/redis.v5
  gopkg.in/redis.v5/internal
  gopkg.in/redis.v5/internal/consistenthash
  gopkg.in/redis.v5/internal/hashtag
  gopkg.in/redis.v5/internal/pool
  gopkg.in/redis.v5/internal/proto
  </code></pre>
  <p>For what it's worth I'm getting this error for every dependency in my go.mod file, I just included the one about redis.</p>