title: Can't import gorilla/mux (github.com/gorilla/mux@v1.7.4: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt)
body: <p>In Go, I was trying simple database connection. I need to import <code>gorilla/mux</code>, but I couldn't.</p>
  
  <p>I am using VS Code. After <code>cd</code> ing to my project directory, I created <code>main.go</code> and did run 
  <code>go get -u github.com/gorilla/mux</code></p>
  
  <p>Here is <strong>main.go</strong></p>
  
  <pre><code>package main
  
  import (
      "database/sql"
      "fmt"
      "github.com/gorilla/mux"
      _ "github.com/lib/pq"
  )
  
  const (
      host     = "localhost"
      port     = 3000
      user     = "postgres"
      password = "postgres"
      dbname   = "test1"
  )
  
  func main() {
      psqlInfo := fmt.Sprintf("host=%s port=%d user=%s "+
          "password=%s dbname=%s sslmode=disable",
          host, port, user, password, dbname)
  
      db, err := sql.Open("postgres", psqlInfo)
      if err != nil {
          panic(err)
      }
      defer db.Close()
  
      err = db.Ping()
      if err != nil {
        panic(err)
      }
  
      fmt.Println("Successfully connected!")
  }
  </code></pre>
  
  <p>[Note that,  after executing <code>go get -u github.com/gorilla/mux</code> terminal shows</p>
  
  <pre><code>C:\Go\src\github.com\IamFrost\go-rest-api&gt;go get -v -u github.com/gorilla/mux
  go: golang.org/x/text upgrade =&gt; v0.3.2
  go: golang.org/x/crypto upgrade =&gt; v0.0.0-20200429183012-4b2356b1ed79
  go: golang.org/x/sys upgrade =&gt; v0.0.0-20200430082407-1f5687305801
  go: golang.org/x/net upgrade =&gt; v0.0.0-20200425230154-ff2c4b7c35a0
  go: downloading golang.org/x/sys v0.0.0-20200430082407-1f5687305801
  golang.org/x/sys/cpu
  golang.org/x/crypto/chacha20poly1305
  crypto/tls
  </code></pre>
  
  <p>]</p>
  
  <p><a href="https://i.stack.imgur.com/hU0Eu.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hU0Eu.png" alt="enter image description here"></a>
  Look i have no other syntax error in mini map. At red mark, when I put mouse, the hover text, its funny to me:</p>
  
  <p>1)<code>imported but not used</code></p>
  
  <p>but the next line</p>
  
  <p>2)<code>no package for import github.com/gorilla/mux</code>)</p>
  
  <p>lol didn't that go against 1) ?</p>
  
  <p>Someone please explain why that occurs</p>
  
  <p>However, </p>
  
  <p>After using <code>go build</code> in <strong>terminal</strong></p>
  
  <p>Here is terminal:</p>
  
  <pre><code>C:\Go\src\github.com\IamFrost\go-rest-api&gt;go build
  go: inconsistent vendoring in C:\Go\src:
          github.com/gorilla/mux@v1.7.4: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
          github.com/lib/pq@v1.4.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
          golang.org/x/crypto@v0.0.0-20200429183012-4b2356b1ed79: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
          golang.org/x/net@v0.0.0-20200425230154-ff2c4b7c35a0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
          golang.org/x/sys@v0.0.0-20200430082407-1f5687305801: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
          golang.org/x/crypto@v0.0.0-20200128174031-69ecbb4d6d5d: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
          golang.org/x/net@v0.0.0-20191126235420-ef20fe5d7933: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
          golang.org/x/sys@v0.0.0-20200201011859-915c9c3d4ccf: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
  
  run 'go mod vendor' to sync, or use -mod=mod or -mod=readonly to ignore the vendor directory
  </code></pre>
  
  <p>[Note : I did 'go mod vendor' also, but no change]</p>
  
  <p>So someone point me why I can't import <code>gorilla/mux</code> or <code>pq</code>. </p>
  
  <p>What else I have to do?</p>
  
  <p>(and please explain what does that mean? <code>is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt</code>)</p>