title: How does one use a variable name with the same name as a package in Go?
body: <p>A common variable name for files or directories is "path".  Unfortunately that is also the name of a package in Go.  Besides, changing path as a argument name in DoIt, how do I get this code to compile?</p>
  
  <pre><code>package main
  
  import (
      "path"
      "os"
  )
  
  func main() {
      DoIt("file.txt")
  }
  
  func DoIt(path string) {
      path.Join(os.TempDir(), path)
  }
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>$6g pathvar.go 
  pathvar.go:4: imported and not used: path
  pathvar.go:13: path.Join undefined (type string has no field or method Join)
  </code></pre>