title: List all imported types given an import path
body: <p>I am trying to list all imported types from a given import path at runtime. Sample code:</p>
  <pre class="lang-golang prettyprint-override"><code>package main
  
  import (
      &quot;fmt&quot;
      &quot;go/importer&quot;
  )
  
  func main() {
      pkg, err := importer.Default().Import(&quot;github.com/aler9/goroslib/pkg/msgs/std_msgs&quot;) 
      if err != nil {
          fmt.Println(&quot;error:&quot;, err)
          return
      }
      for _, declName := range pkg.Scope().Names() {
          fmt.Println(declName)
      }
  }
  
  </code></pre>
  <p>This results in error:</p>
  <blockquote>
  <p>error: can't find import: &quot;github.com/aler9/goroslib/pkg/msgs/std_msgs&quot;</p>
  </blockquote>
  <p>It is possbile to achieve what I want with Golang?</p>
  <hr />
  <p>Note:</p>
  <p>I am aware of the post: <a href="https://stackoverflow.com/questions/56259230/how-to-use-go-importer">How to use go importer</a></p>
  <p>By using <code>pkg, err := importer.Default().Import(&quot;github.com/aler9/goroslib&quot;)</code> the binary returns a few types but they are not what I want.</p>
  <hr />