如何从Go编译的语言x包中获取类型信息?

I want to write a simple editor with basic autocomplete functionality for the Go language as a pet project. How would one go about doing it? I took a look at the Go plugins for Eclipse and IntelliJ, but they were too big for me to comprehend (not to mention getting one to compile).

The Go standard library offers the building blocks for a Go parser which you can use to parse the source files and look for function definitions and the like.

There's also the godoc command which already does what you want: extracting method definitions and it's documentation. You may look in the source code to see how godoc is working or use godoc directly.

This editor written in Go projects has a manageable amount of code, you may look into it.

The de facto standard approach to this problem is to use nsf's gocode. I have tried it only in Vim - it works very well.

Even though there's ready made support for specific editors, gocode is not editor specific. It's a daemon with a communication protocol. It is thus usable from any program.