title: Check for installed packages in Go
body: <p>I need to check if some packages are installed but I need to do that using code, not <code>go list</code> tool in shell. I found a solution but it's very slow (2-3 seconds). This is my current code:</p>
  
  <pre><code>out, err := exec.Command("sh", "-c", "go list all").Output()
  if err != nil {
      output := strings.Split(string(out), "\n")
      for _, value := range output {
          if value == "github.com/some/package" {
              // package is installed
          }
      }
  }
  </code></pre>