nsf/gocode

Package field isn't being populated

Closed this issue · 2 comments

Perhaps I'm misunderstanding, but lets say I have this code:

package main

func main() {
  http.Handler
}

If I use gocode at the end of the term Handler (position 42) I get output like this:

[
  7,
  [
    {
      "class": "type",
      "name": "Handler",
      "type": "interface",
      "package": ""
    },
    {
      "class": "type",
      "name": "HandlerFunc",
      "type": "func(http.ResponseWriter, *http.Request)",
      "package": ""
    }
  ]
]

Note: I made the output "pretty"

The package is never being populated for some reason, but I'd expect it to be net/http or something similar. Is this unimplemented, broken, or does it work differently than I expect?

I'm trying to look at options to find something else that might need set for this but so far no luck.

nsf commented

well in your case you don't have it imported, there is no import "net/http" in your code. So the gocode uses automatic package import and doesn't populate the "package" field. It must be a bug. I'll have a look at it.

Thanks!