Note: this only happens if the Foo struct is in another package.
When I try to autocomplete this (e.g. gocode autocomplete main.go 81)
Expected:
I only get Bar because my cursor is inside the struct
2017/10/13 08:18:01 Number of candidates found: 1
2017/10/13 08:18:01 Candidates are:
2017/10/13 08:18:01 var Bar string
2017/10/13 08:18:01 =======================================================
Actual:
I get all "global" candidates:
2017/10/13 08:17:11 Number of candidates found: 43
2017/10/13 08:17:11 Candidates are:
2017/10/13 08:17:11 const false
2017/10/13 08:17:11 const iota
2017/10/13 08:17:11 const nil
2017/10/13 08:17:11 const true
2017/10/13 08:17:11 func append([]type, ...type) []type
2017/10/13 08:17:11 func cap(container) int
2017/10/13 08:17:11 func close(channel)
2017/10/13 08:17:11 func complex(real, imag) complex
2017/10/13 08:17:11 func copy(dst, src)
2017/10/13 08:17:11 func delete(map[typeA]typeB, typeA)
2017/10/13 08:17:11 func imag(complex)
2017/10/13 08:17:11 func len(container) int
2017/10/13 08:17:11 func main()
2017/10/13 08:17:11 func make(type, len[, cap]) type
2017/10/13 08:17:11 func new(type) *type
2017/10/13 08:17:11 func panic(interface{})
2017/10/13 08:17:11 func print(...interface{})
2017/10/13 08:17:11 func println(...interface{})
2017/10/13 08:17:11 func real(complex)
2017/10/13 08:17:11 func recover() interface{}
2017/10/13 08:17:11 package fmt
2017/10/13 08:17:11 package lib
2017/10/13 08:17:11 type bool built-in
2017/10/13 08:17:11 type byte built-in
2017/10/13 08:17:11 type complex128 built-in
2017/10/13 08:17:11 type complex64 built-in
2017/10/13 08:17:11 type error interface
2017/10/13 08:17:11 type float32 built-in
2017/10/13 08:17:11 type float64 built-in
2017/10/13 08:17:11 type int built-in
2017/10/13 08:17:11 type int16 built-in
2017/10/13 08:17:11 type int32 built-in
2017/10/13 08:17:11 type int64 built-in
2017/10/13 08:17:11 type int8 built-in
2017/10/13 08:17:11 type rune built-in
2017/10/13 08:17:11 type string built-in
2017/10/13 08:17:11 type uint built-in
2017/10/13 08:17:11 type uint16 built-in
2017/10/13 08:17:11 type uint32 built-in
2017/10/13 08:17:11 type uint64 built-in
2017/10/13 08:17:11 type uint8 built-in
2017/10/13 08:17:11 type uintptr built-in
2017/10/13 08:17:11 var tmp lib.Foo
2017/10/13 08:17:11 =======================================================
Problem:
Checking out the parent commit c7fddb39ecbc9ebd1ebe7d2a3af473ed0fffffa1 returns the correct suggestions. So I assume that 1a78dd6c36d7f37cbb60073523c2e9ca3f6519fa has introduced a bug.
Given that gocode is checked out with commit: 1a78dd6c36d7f37cbb60073523c2e9ca3f6519fa (= current HEAD at the time of writing this)
And I have the following code
foo.go
contains:and
main.go
:where # is my cursor.
Note: this only happens if the
Foo
struct is in another package.When I try to autocomplete this (e.g.
gocode autocomplete main.go 81
)Expected: I only get
Bar
because my cursor is inside the structActual: I get all "global" candidates:
Problem:
Checking out the parent commit c7fddb39ecbc9ebd1ebe7d2a3af473ed0fffffa1 returns the correct suggestions. So I assume that 1a78dd6c36d7f37cbb60073523c2e9ca3f6519fa has introduced a bug.
(source: https://github.com/joefitzgerald/go-plus/issues/598#issuecomment-336076119)