mdempsky / gocode

An autocompletion daemon for the Go programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add support for dep

gencer opened this issue · comments

What version of Go are you using (go version)?

1.11.2

What operating system and processor architecture are you using (go env)?

Windows 10 x64

I am using VSCode and my auto-complete was fine until I decided to update gocode. Recently after upgrading latest gocode. Many people complaining about auto complete doesn't work. However, current situation that I'm in is not related to Go Version or not go-specific.

I start to download and build & install every each one of your commits.

This is the latest commit that works perfectly: c797e02

If I build & install from this commit, I get auto-complete works like a charm. But a bit slower at start. However, If I go more commits back like this one: 81c08d0 things go faster. As I said, both commits works but last (oldest) one works much better (as of performance).

Maybe this can give you a clue on what is wrong with Auto-Complete stuff.

If I use master, auto complete outside of current file does not get listed. It says candidates: 0. But with c797e02 it just works.

Why is this happening in recent commits? What's changed? How to fix it?

Auto completes does not work wherever it resides in vendor/ or $GOPATH/src/**

i have the same issue. go1.11.2 linux/amd64

Based on what you've written here, it seems like 6e33d32 is the breaking commit for you. This hides the -fallback-to-source behavior behind that flag, which uses the source importer (https://godoc.org/go/importer#For). You can try configuring your gocode flags to pass in -fallback-to-source on each request. However, I first try using the -i flag when building your packages, as that will create the *.a files in your $GOPATH/pkg. It seems like those aren't available, which is why gocode is failing.

@stamblerre I did try -i and it did not help. How can i make fallback to source flag in vscode? I do not want to start server each time.

-fallback-to-source (which also needs to be paired with -cache on the server-side) is a client flag. I recently added microsoft/vscode-go#2103 to VSCode-Go, so it's possible the latest release doesn't yet have the ability to specify the flags yet, but I imagine you can install the beta by following the instructions here.

If go build -i didn't work, can you check if you have files in your $GOPATH/pkg? I'd be quite surprised if that's not the issue. Would you mind posting the debug output of gocode? Just run gocode close and then gocode -s -debug and trigger a completion request through your editor. Thanks!

What I do?

start server with gocode -s -debug

enter chilkat_example1 dir and run go build -i. It takes while but finished successfully.

Go to editor (vscode) and try to write http. I expect list of available methods but nothing listed. You can see output below:

gence@GENCER MINGW64 /d/Go/src/chilkat_example1
$ gocode -s -debug -cache
2018/11/13 21:21:56 Got autocompletion request for 'd:\Go\src\chilkat_example1\main.go'
2018/11/13 21:21:56 Cursor at: 386
2018/11/13 21:21:56 -------------------------------------------------------
package main

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        http.#
                fmt.Println(http.Version())

}
2018/11/13 21:21:56 -------------------------------------------------------
2018/11/13 21:21:56 Error parsing input file (outer block):
2018/11/13 21:21:56  d:\Go\src\chilkat_example1\main.go:20:7: expected selectoror type assertion, found ';'
2018/11/13 21:21:56  d:\Go\src\chilkat_example1\main.go:21:3: expected ';', found fmt
2018/11/13 21:21:56  d:\Go\src\chilkat_example1\main.go:23:4: expected ';', found 'EOF'
2018/11/13 21:21:56  d:\Go\src\chilkat_example1\main.go:23:4: expected '}', found 'EOF'
2018/11/13 21:21:56 Elapsed duration: 8.0024ms
2018/11/13 21:21:56 Offset: 0
2018/11/13 21:21:56 Number of candidates found: 0
2018/11/13 21:21:56 Candidates are:
2018/11/13 21:21:56 =======================================================
2018/11/13 21:21:56 Got autocompletion request for 'd:\Go\src\chilkat_example1\main.go'
2018/11/13 21:21:56 Cursor at: 404
2018/11/13 21:21:56 -------------------------------------------------------
package main
import "net/http"

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        http.#
                fmt.Println(http.Version())

}
2018/11/13 21:21:56 -------------------------------------------------------
2018/11/13 21:21:56 Error parsing input file (outer block):
2018/11/13 21:21:56  d:\Go\src\chilkat_example1\main.go:21:7: expected selectoror type assertion, found ';'
2018/11/13 21:21:56  d:\Go\src\chilkat_example1\main.go:22:3: expected ';', found fmt
2018/11/13 21:21:56  d:\Go\src\chilkat_example1\main.go:24:4: expected ';', found 'EOF'
2018/11/13 21:21:56  d:\Go\src\chilkat_example1\main.go:24:4: expected '}', found 'EOF'
2018/11/13 21:21:56 Elapsed duration: 31.0072ms
2018/11/13 21:21:56 Offset: 0
2018/11/13 21:21:56 Number of candidates found: 0
2018/11/13 21:21:56 Candidates are:
2018/11/13 21:21:56 =======================================================
2018/11/13 21:21:57 Got autocompletion request for 'd:\Go\src\chilkat_example1\main.go'
2018/11/13 21:21:57 Cursor at: 386
2018/11/13 21:21:57 -------------------------------------------------------
package main

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        http.#
                fmt.Println(http.Version())

}
2018/11/13 21:21:57 -------------------------------------------------------
2018/11/13 21:21:57 Error parsing input file (outer block):
2018/11/13 21:21:57  d:\Go\src\chilkat_example1\main.go:20:7: expected selectoror type assertion, found ';'
2018/11/13 21:21:57  d:\Go\src\chilkat_example1\main.go:21:3: expected ';', found fmt
2018/11/13 21:21:57  d:\Go\src\chilkat_example1\main.go:23:4: expected ';', found 'EOF'
2018/11/13 21:21:57  d:\Go\src\chilkat_example1\main.go:23:4: expected '}', found 'EOF'
2018/11/13 21:21:57 Elapsed duration: 4.0012ms
2018/11/13 21:21:57 Offset: 0
2018/11/13 21:21:57 Number of candidates found: 0
2018/11/13 21:21:57 Candidates are:
2018/11/13 21:21:57 =======================================================
2018/11/13 21:21:57 Got autocompletion request for 'd:\Go\src\chilkat_example1\main.go'
2018/11/13 21:21:57 Cursor at: 404
2018/11/13 21:21:57 -------------------------------------------------------
package main
import "net/http"

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        http.#
                fmt.Println(http.Version())

}
2018/11/13 21:21:57 -------------------------------------------------------
2018/11/13 21:21:57 Error parsing input file (outer block):
2018/11/13 21:21:57  d:\Go\src\chilkat_example1\main.go:21:7: expected selectoror type assertion, found ';'
2018/11/13 21:21:57  d:\Go\src\chilkat_example1\main.go:22:3: expected ';', found fmt
2018/11/13 21:21:57  d:\Go\src\chilkat_example1\main.go:24:4: expected ';', found 'EOF'
2018/11/13 21:21:57  d:\Go\src\chilkat_example1\main.go:24:4: expected '}', found 'EOF'
2018/11/13 21:21:57 Elapsed duration: 5.9997ms
2018/11/13 21:21:57 Offset: 0
2018/11/13 21:21:57 Number of candidates found: 0
2018/11/13 21:21:57 Candidates are:
2018/11/13 21:21:57 =======================================================
2018/11/13 21:21:58 Got autocompletion request for 'd:\Go\src\chilkat_example1\main.go'
2018/11/13 21:21:58 Cursor at: 386
2018/11/13 21:21:58 -------------------------------------------------------
package main

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        http.#
                fmt.Println(http.Version())

}
2018/11/13 21:21:58 -------------------------------------------------------
2018/11/13 21:21:58 Error parsing input file (outer block):
2018/11/13 21:21:58  d:\Go\src\chilkat_example1\main.go:20:7: expected selectoror type assertion, found ';'
2018/11/13 21:21:58  d:\Go\src\chilkat_example1\main.go:21:3: expected ';', found fmt
2018/11/13 21:21:58  d:\Go\src\chilkat_example1\main.go:23:4: expected ';', found 'EOF'
2018/11/13 21:21:58  d:\Go\src\chilkat_example1\main.go:23:4: expected '}', found 'EOF'
2018/11/13 21:21:58 Elapsed duration: 7.0006ms
2018/11/13 21:21:58 Offset: 0
2018/11/13 21:21:58 Number of candidates found: 0
2018/11/13 21:21:58 Candidates are:
2018/11/13 21:21:58 =======================================================
2018/11/13 21:21:58 Got autocompletion request for 'd:\Go\src\chilkat_example1\main.go'
2018/11/13 21:21:58 Cursor at: 404
2018/11/13 21:21:58 -------------------------------------------------------
package main
import "net/http"

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        http.#
                fmt.Println(http.Version())

}
2018/11/13 21:21:58 -------------------------------------------------------
2018/11/13 21:21:58 Error parsing input file (outer block):
2018/11/13 21:21:58  d:\Go\src\chilkat_example1\main.go:21:7: expected selectoror type assertion, found ';'
2018/11/13 21:21:58  d:\Go\src\chilkat_example1\main.go:22:3: expected ';', found fmt
2018/11/13 21:21:58  d:\Go\src\chilkat_example1\main.go:24:4: expected ';', found 'EOF'
2018/11/13 21:21:58  d:\Go\src\chilkat_example1\main.go:24:4: expected '}', found 'EOF'
2018/11/13 21:21:58 Elapsed duration: 10.0024ms
2018/11/13 21:21:58 Offset: 0
2018/11/13 21:21:58 Number of candidates found: 0
2018/11/13 21:21:58 Candidates are:
2018/11/13 21:21:58 =======================================================
2018/11/13 21:21:59 Got autocompletion request for 'd:\Go\src\chilkat_example1\main.go'
2018/11/13 21:21:59 Cursor at: 386
2018/11/13 21:21:59 -------------------------------------------------------
package main

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        http.#
                fmt.Println(http.Version())

}
2018/11/13 21:21:59 -------------------------------------------------------
2018/11/13 21:21:59 Error parsing input file (outer block):
2018/11/13 21:21:59  d:\Go\src\chilkat_example1\main.go:20:7: expected selectoror type assertion, found ';'
2018/11/13 21:21:59  d:\Go\src\chilkat_example1\main.go:21:3: expected ';', found fmt
2018/11/13 21:21:59  d:\Go\src\chilkat_example1\main.go:23:4: expected ';', found 'EOF'
2018/11/13 21:21:59  d:\Go\src\chilkat_example1\main.go:23:4: expected '}', found 'EOF'
2018/11/13 21:21:59 Elapsed duration: 4.0002ms
2018/11/13 21:21:59 Offset: 0
2018/11/13 21:21:59 Number of candidates found: 0
2018/11/13 21:21:59 Candidates are:
2018/11/13 21:21:59 =======================================================
2018/11/13 21:21:59 Got autocompletion request for 'd:\Go\src\chilkat_example1\main.go'
2018/11/13 21:21:59 Cursor at: 404
2018/11/13 21:21:59 -------------------------------------------------------
package main
import "net/http"

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        http.#
                fmt.Println(http.Version())

}
2018/11/13 21:21:59 -------------------------------------------------------
2018/11/13 21:21:59 Error parsing input file (outer block):
2018/11/13 21:21:59  d:\Go\src\chilkat_example1\main.go:21:7: expected selectoror type assertion, found ';'
2018/11/13 21:21:59  d:\Go\src\chilkat_example1\main.go:22:3: expected ';', found fmt
2018/11/13 21:21:59  d:\Go\src\chilkat_example1\main.go:24:4: expected ';', found 'EOF'
2018/11/13 21:21:59  d:\Go\src\chilkat_example1\main.go:24:4: expected '}', found 'EOF'
2018/11/13 21:21:59 Elapsed duration: 7.0035ms
2018/11/13 21:21:59 Offset: 0
2018/11/13 21:21:59 Number of candidates found: 0
2018/11/13 21:21:59 Candidates are:
2018/11/13 21:21:59 =======================================================
2018/11/13 21:22:00 Got autocompletion request for 'd:\Go\src\chilkat_example1\main.go'
2018/11/13 21:22:00 Cursor at: 386
2018/11/13 21:22:00 -------------------------------------------------------
package main

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        http.#
                fmt.Println(http.Version())

}
2018/11/13 21:22:00 -------------------------------------------------------
2018/11/13 21:22:00 Error parsing input file (outer block):
2018/11/13 21:22:00  d:\Go\src\chilkat_example1\main.go:20:7: expected selectoror type assertion, found ';'
2018/11/13 21:22:00  d:\Go\src\chilkat_example1\main.go:21:3: expected ';', found fmt
2018/11/13 21:22:00  d:\Go\src\chilkat_example1\main.go:23:4: expected ';', found 'EOF'
2018/11/13 21:22:00  d:\Go\src\chilkat_example1\main.go:23:4: expected '}', found 'EOF'
2018/11/13 21:22:00 Elapsed duration: 8.0008ms
2018/11/13 21:22:00 Offset: 0
2018/11/13 21:22:00 Number of candidates found: 0
2018/11/13 21:22:00 Candidates are:
2018/11/13 21:22:00 =======================================================
2018/11/13 21:22:00 Got autocompletion request for 'd:\Go\src\chilkat_example1\main.go'
2018/11/13 21:22:00 Cursor at: 404
2018/11/13 21:22:00 -------------------------------------------------------
package main
import "net/http"

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        http.#
                fmt.Println(http.Version())

}
2018/11/13 21:22:00 -------------------------------------------------------
2018/11/13 21:22:00 Error parsing input file (outer block):
2018/11/13 21:22:00  d:\Go\src\chilkat_example1\main.go:21:7: expected selectoror type assertion, found ';'
2018/11/13 21:22:00  d:\Go\src\chilkat_example1\main.go:22:3: expected ';', found fmt
2018/11/13 21:22:00  d:\Go\src\chilkat_example1\main.go:24:4: expected ';', found 'EOF'
2018/11/13 21:22:00  d:\Go\src\chilkat_example1\main.go:24:4: expected '}', found 'EOF'
2018/11/13 21:22:00 Elapsed duration: 6.0013ms
2018/11/13 21:22:00 Offset: 0
2018/11/13 21:22:00 Number of candidates found: 0
2018/11/13 21:22:00 Candidates are:
2018/11/13 21:22:00 =======================================================
2018/11/13 21:22:01 Got autocompletion request for 'd:\Go\src\chilkat_example1\main.go'
2018/11/13 21:22:01 Cursor at: 386
2018/11/13 21:22:01 -------------------------------------------------------
package main

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        http.#
                fmt.Println(http.Version())

}
2018/11/13 21:22:01 -------------------------------------------------------
2018/11/13 21:22:01 Error parsing input file (outer block):
2018/11/13 21:22:01  d:\Go\src\chilkat_example1\main.go:20:7: expected selectoror type assertion, found ';'
2018/11/13 21:22:01  d:\Go\src\chilkat_example1\main.go:21:3: expected ';', found fmt
2018/11/13 21:22:01  d:\Go\src\chilkat_example1\main.go:23:4: expected ';', found 'EOF'
2018/11/13 21:22:01  d:\Go\src\chilkat_example1\main.go:23:4: expected '}', found 'EOF'
2018/11/13 21:22:01 Elapsed duration: 4.0009ms
2018/11/13 21:22:01 Offset: 0
2018/11/13 21:22:01 Number of candidates found: 0
2018/11/13 21:22:01 Candidates are:
2018/11/13 21:22:01 =======================================================
2018/11/13 21:22:01 Got autocompletion request for 'd:\Go\src\chilkat_example1\main.go'
2018/11/13 21:22:01 Cursor at: 404
2018/11/13 21:22:01 -------------------------------------------------------
package main
import "net/http"

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        http.#
                fmt.Println(http.Version())

}
2018/11/13 21:22:01 -------------------------------------------------------
2018/11/13 21:22:01 Error parsing input file (outer block):
2018/11/13 21:22:01  d:\Go\src\chilkat_example1\main.go:21:7: expected selectoror type assertion, found ';'
2018/11/13 21:22:01  d:\Go\src\chilkat_example1\main.go:22:3: expected ';', found fmt
2018/11/13 21:22:01  d:\Go\src\chilkat_example1\main.go:24:4: expected ';', found 'EOF'
2018/11/13 21:22:01  d:\Go\src\chilkat_example1\main.go:24:4: expected '}', found 'EOF'
2018/11/13 21:22:01 Elapsed duration: 5.0008ms
2018/11/13 21:22:01 Offset: 0
2018/11/13 21:22:01 Number of candidates found: 0
2018/11/13 21:22:01 Candidates are:
2018/11/13 21:22:01 =======================================================

Previous commits that I stated works. go-langserver also works.

After that I tried to install latest vsix from vscode. It did not worked. Either latest vsix doesn't contain you changes (merged recently) or it just doesn't work.

Anyway, I manually close and start debug for gocode with cache and fallback and output is the same:

2018/11/13 21:31:37 Got autocompletion request for 'd:\Go\src\example\main.go'
2018/11/13 21:31:37 Cursor at: 406
2018/11/13 21:31:37 -------------------------------------------------------
package main
import "chilkat"

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        chilkat.#
        fmt.Println(http.Version())

}
2018/11/13 21:31:37 -------------------------------------------------------
2018/11/13 21:31:37 Error parsing input file (outer block):
2018/11/13 21:31:37  d:\Go\src\example\main.go:21:10: expected selector or typeassertion, found ';'
2018/11/13 21:31:37  d:\Go\src\example\main.go:22:2: expected ';', found fmt
2018/11/13 21:31:37  d:\Go\src\example\main.go:24:4: expected ';', found 'EOF'
2018/11/13 21:31:37  d:\Go\src\example\main.go:24:4: expected '}', found 'EOF'
2018/11/13 21:31:37 Elapsed duration: 10.0029ms
2018/11/13 21:31:37 Offset: 0
2018/11/13 21:31:37 Number of candidates found: 0
2018/11/13 21:31:37 Candidates are:
2018/11/13 21:31:37 =======================================================

Something is preventing auto complete in recent commits. I hope you can find that issue. I'm going to die here by looking every file when autocomplete does not work.

Btw, i forgot to mention i have few .a files in pkg dir such as models.a and chilkat.a including vendor directory.

Can you try running gocode close and gocode -s -cache -debug as well? I'd be curious to see if you the caching version works for you.

@stamblerre, same behavior:

2018/11/14 09:58:58 -------------------------------------------------------
2018/11/14 09:58:58 Error parsing input file (outer block):
2018/11/14 09:58:58  d:\Go\src\example\main.go:20:10: expected selector or typeassertion, found ';'
2018/11/14 09:58:58  d:\Go\src\example\main.go:21:2: expected ';', found fmt
2018/11/14 09:58:58  d:\Go\src\example\main.go:23:4: expected ';', found 'EOF'
2018/11/14 09:58:58  d:\Go\src\example\main.go:23:4: expected '}', found 'EOF'
2018/11/14 09:58:58 Elapsed duration: 6.0008ms
2018/11/14 09:58:58 Offset: 0
2018/11/14 09:58:58 Number of candidates found: 0
2018/11/14 09:58:58 Candidates are:
2018/11/14 09:58:58 =======================================================
2018/11/14 09:58:59 Got autocompletion request for 'd:\Go\src\example\main.go'
2018/11/14 09:58:59 Cursor at: 406
2018/11/14 09:58:59 -------------------------------------------------------
package main
import "chilkat"

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        chilkat.#
        fmt.Println(http.Version())

}
2018/11/14 09:58:59 -------------------------------------------------------
2018/11/14 09:58:59 Error parsing input file (outer block):
2018/11/14 09:58:59  d:\Go\src\example\main.go:21:10: expected selector or typeassertion, found ';'
2018/11/14 09:58:59  d:\Go\src\example\main.go:22:2: expected ';', found fmt
2018/11/14 09:58:59  d:\Go\src\example\main.go:24:4: expected ';', found 'EOF'
2018/11/14 09:58:59  d:\Go\src\example\main.go:24:4: expected '}', found 'EOF'
2018/11/14 09:58:59 Elapsed duration: 4.9995ms
2018/11/14 09:58:59 Offset: 0
2018/11/14 09:58:59 Number of candidates found: 0
2018/11/14 09:58:59 Candidates are:
2018/11/14 09:58:59 =======================================================

Also it autocompletes local variables as you can see below but not within it:

$ gocode -s -debug -cache

Result:

2018/11/14 10:40:43 -------------------------------------------------------
2018/11/14 10:40:43 Elapsed duration: 7.002ms
2018/11/14 10:40:43 Offset: 0
2018/11/14 10:40:43 Number of candidates found: 7
2018/11/14 10:40:43 Candidates are:
2018/11/14 10:40:43   func cap(v Type) int
2018/11/14 10:40:43   func close(c chan<- Type)
2018/11/14 10:40:43   func complex(real FloatType, imag FloatType) ComplexType
2018/11/14 10:40:43   func copy(dst []Type, src []Type) int
2018/11/14 10:40:43   package chilkat
2018/11/14 10:40:43   type complex128 complex128
2018/11/14 10:40:43   type complex64 complex64
2018/11/14 10:40:43 =======================================================
2018/11/14 10:40:50 Got autocompletion request for 'd:\Go\src\example\main.go'
2018/11/14 10:40:50 Cursor at: 389
2018/11/14 10:40:50 -------------------------------------------------------
package main

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        chilkat.#
        fmt.Println(http.Version())

}
2018/11/14 10:40:50 -------------------------------------------------------
2018/11/14 10:40:50 Error parsing input file (outer block):
2018/11/14 10:40:50  d:\Go\src\example\main.go:20:10: expected selector or typeassertion, found ';'
2018/11/14 10:40:50  d:\Go\src\example\main.go:21:2: expected ';', found fmt
2018/11/14 10:40:50  d:\Go\src\example\main.go:23:4: expected ';', found 'EOF'
2018/11/14 10:40:50  d:\Go\src\example\main.go:23:4: expected '}', found 'EOF'
2018/11/14 10:40:50 Elapsed duration: 6.0011ms
2018/11/14 10:40:50 Offset: 0
2018/11/14 10:40:50 Number of candidates found: 0
2018/11/14 10:40:50 Candidates are:
2018/11/14 10:40:50 =======================================================
2018/11/14 10:40:50 Got autocompletion request for 'd:\Go\src\example\main.go'
2018/11/14 10:40:50 Cursor at: 406
2018/11/14 10:40:50 -------------------------------------------------------
package main
import "chilkat"

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        chilkat.#
        fmt.Println(http.Version())

}
2018/11/14 10:40:50 -------------------------------------------------------
2018/11/14 10:40:50 Error parsing input file (outer block):
2018/11/14 10:40:50  d:\Go\src\example\main.go:21:10: expected selector or typeassertion, found ';'
2018/11/14 10:40:50  d:\Go\src\example\main.go:22:2: expected ';', found fmt
2018/11/14 10:40:50  d:\Go\src\example\main.go:24:4: expected ';', found 'EOF'
2018/11/14 10:40:50  d:\Go\src\example\main.go:24:4: expected '}', found 'EOF'
2018/11/14 10:40:50 Elapsed duration: 6.0012ms
2018/11/14 10:40:50 Offset: 0
2018/11/14 10:40:50 Number of candidates found: 0
2018/11/14 10:40:50 Candidates are:
2018/11/14 10:40:50 =======================================================

I just added some improved logging (fa825ca). Can you try syncing to head and then posting the debug output again?

Hey @stamblerre,

I tried with -cache and -cache -fallback-to-source. Here are outputs:

$ gocode -s -debug -cache

Gives:

2018/11/15 00:06:29 Got autocompletion request for 'd:\Go\src\example\main.go'
2018/11/15 00:06:29 Cursor at: 389
2018/11/15 00:06:29 -------------------------------------------------------
package main

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        chilkat.#
                fmt.Println(http.Version())

}
2018/11/15 00:06:29 -------------------------------------------------------
2018/11/15 00:06:29 Error parsing input file (outer block):
2018/11/15 00:06:29  d:\Go\src\example\main.go:20:10: expected selector or typeassertion, found ';'
2018/11/15 00:06:29  d:\Go\src\example\main.go:21:3: expected ';', found fmt
2018/11/15 00:06:29  d:\Go\src\example\main.go:23:4: expected ';', found 'EOF'
2018/11/15 00:06:29  d:\Go\src\example\main.go:23:4: expected '}', found 'EOF'
2018/11/15 00:06:29 cache: no gcexportdata file for [chilkat]
2018/11/15 00:06:29 cache: failed to fall back to another importer for [<nil> can't find import: "chilkat"]: %!v(MISSING)
2018/11/15 00:06:29 Elapsed duration: 9.0029ms
2018/11/15 00:06:29 Offset: 0
2018/11/15 00:06:29 Number of candidates found: 0
2018/11/15 00:06:29 Candidates are:
2018/11/15 00:06:29 =======================================================
2018/11/15 00:06:29 Got autocompletion request for 'd:\Go\src\example\main.go'
2018/11/15 00:06:29 Cursor at: 406
2018/11/15 00:06:29 -------------------------------------------------------
package main
import "chilkat"

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        chilkat.#
                fmt.Println(http.Version())

}
2018/11/15 00:06:29 -------------------------------------------------------
2018/11/15 00:06:29 Error parsing input file (outer block):
2018/11/15 00:06:29  d:\Go\src\example\main.go:21:10: expected selector or typeassertion, found ';'
2018/11/15 00:06:29  d:\Go\src\example\main.go:22:3: expected ';', found fmt
2018/11/15 00:06:29  d:\Go\src\example\main.go:24:4: expected ';', found 'EOF'
2018/11/15 00:06:29  d:\Go\src\example\main.go:24:4: expected '}', found 'EOF'
2018/11/15 00:06:29 cache: no gcexportdata file for [chilkat]
2018/11/15 00:06:29 cache: failed to fall back to another importer for [<nil> can't find import: "chilkat"]: %!v(MISSING)
2018/11/15 00:06:29 Elapsed duration: 16.0041ms
2018/11/15 00:06:29 Offset: 0
2018/11/15 00:06:29 Number of candidates found: 0
2018/11/15 00:06:29 Candidates are:
2018/11/15 00:06:29 =======================================================
$ gocode -s -debug -cache -fallback-to-source

Gives:

2018/11/15 00:09:15 Got autocompletion request for 'd:\Go\src\example\main.go'
2018/11/15 00:09:15 Cursor at: 389
2018/11/15 00:09:15 -------------------------------------------------------
package main

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        chilkat.#
                fmt.Println(http.Version())

}
2018/11/15 00:09:15 -------------------------------------------------------
2018/11/15 00:09:15 Error parsing input file (outer block):
2018/11/15 00:09:15  d:\Go\src\example\main.go:20:10: expected selector or typeassertion, found ';'
2018/11/15 00:09:15  d:\Go\src\example\main.go:21:3: expected ';', found fmt
2018/11/15 00:09:15  d:\Go\src\example\main.go:23:4: expected ';', found 'EOF'
2018/11/15 00:09:15  d:\Go\src\example\main.go:23:4: expected '}', found 'EOF'
2018/11/15 00:09:15 cache: no gcexportdata file for [chilkat]
2018/11/15 00:09:15 cache: failed to fall back to another importer for [<nil> can't find import: "chilkat"]: %!v(MISSING)
2018/11/15 00:09:15 Elapsed duration: 10.0029ms
2018/11/15 00:09:15 Offset: 0
2018/11/15 00:09:15 Number of candidates found: 0
2018/11/15 00:09:15 Candidates are:
2018/11/15 00:09:15 =======================================================
2018/11/15 00:09:15 Got autocompletion request for 'd:\Go\src\example\main.go'
2018/11/15 00:09:15 Cursor at: 406
2018/11/15 00:09:15 -------------------------------------------------------
package main
import "chilkat"

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        chilkat.#
                fmt.Println(http.Version())

}
2018/11/15 00:09:15 -------------------------------------------------------
2018/11/15 00:09:15 Error parsing input file (outer block):
2018/11/15 00:09:15  d:\Go\src\example\main.go:21:10: expected selector or typeassertion, found ';'
2018/11/15 00:09:15  d:\Go\src\example\main.go:22:3: expected ';', found fmt
2018/11/15 00:09:15  d:\Go\src\example\main.go:24:4: expected ';', found 'EOF'
2018/11/15 00:09:15  d:\Go\src\example\main.go:24:4: expected '}', found 'EOF'
2018/11/15 00:09:15 cache: no gcexportdata file for [chilkat]
2018/11/15 00:09:15 cache: failed to fall back to another importer for [<nil> can't find import: "chilkat"]: %!v(MISSING)
2018/11/15 00:09:15 Elapsed duration: 6.0008ms
2018/11/15 00:09:15 Offset: 0
2018/11/15 00:09:15 Number of candidates found: 0
2018/11/15 00:09:15 Candidates are:
2018/11/15 00:09:15 =======================================================


Can you try also once without -cache please? Thanks!

Sure. Here you go:

2018/11/15 00:20:28 Got autocompletion request for 'd:\Go\src\example\main.go'
2018/11/15 00:20:28 Cursor at: 388
2018/11/15 00:20:28 -------------------------------------------------------
package main

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        chilkat#
                fmt.Println(http.Version())

}
2018/11/15 00:20:28 -------------------------------------------------------
2018/11/15 00:20:28 gbimporter: no package found for [chilkat can't find import: "chilkat"]: %!v(MISSING)
2018/11/15 00:20:28 Elapsed duration: 9.0007ms
2018/11/15 00:20:28 Offset: 0
2018/11/15 00:20:28 Number of candidates found: 1
2018/11/15 00:20:28 Candidates are:
2018/11/15 00:20:28   package chilkat
2018/11/15 00:20:28 =======================================================
2018/11/15 00:20:30 Got autocompletion request for 'd:\Go\src\example\main.go'
2018/11/15 00:20:30 Cursor at: 389
2018/11/15 00:20:30 -------------------------------------------------------
package main

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        chilkat.#
                fmt.Println(http.Version())

}
2018/11/15 00:20:30 -------------------------------------------------------
2018/11/15 00:20:30 Error parsing input file (outer block):
2018/11/15 00:20:30  d:\Go\src\example\main.go:20:10: expected selector or typeassertion, found ';'
2018/11/15 00:20:30  d:\Go\src\example\main.go:21:3: expected ';', found fmt
2018/11/15 00:20:30  d:\Go\src\example\main.go:23:4: expected ';', found 'EOF'
2018/11/15 00:20:30  d:\Go\src\example\main.go:23:4: expected '}', found 'EOF'
2018/11/15 00:20:30 gbimporter: no package found for [chilkat can't find import: "chilkat"]: %!v(MISSING)
2018/11/15 00:20:30 Elapsed duration: 7.0015ms
2018/11/15 00:20:30 Offset: 0
2018/11/15 00:20:30 Number of candidates found: 0
2018/11/15 00:20:30 Candidates are:
2018/11/15 00:20:30 =======================================================
2018/11/15 00:20:30 Got autocompletion request for 'd:\Go\src\example\main.go'
2018/11/15 00:20:30 Cursor at: 406
2018/11/15 00:20:30 -------------------------------------------------------
package main
import "chilkat"

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        chilkat.#
                fmt.Println(http.Version())

}
2018/11/15 00:20:30 -------------------------------------------------------
2018/11/15 00:20:30 Error parsing input file (outer block):
2018/11/15 00:20:30  d:\Go\src\example\main.go:21:10: expected selector or typeassertion, found ';'
2018/11/15 00:20:30  d:\Go\src\example\main.go:22:3: expected ';', found fmt
2018/11/15 00:20:30  d:\Go\src\example\main.go:24:4: expected ';', found 'EOF'
2018/11/15 00:20:30  d:\Go\src\example\main.go:24:4: expected '}', found 'EOF'
2018/11/15 00:20:30 gbimporter: no package found for [chilkat can't find import: "chilkat"]: %!v(MISSING)
2018/11/15 00:20:30 Elapsed duration: 7.0008ms
2018/11/15 00:20:30 Offset: 0
2018/11/15 00:20:30 Number of candidates found: 0
2018/11/15 00:20:30 Candidates are:
2018/11/15 00:20:30 =======================================================
2018/11/15 00:20:33 Got autocompletion request for 'd:\Go\src\example\main.go'
2018/11/15 00:20:33 Cursor at: 389
2018/11/15 00:20:33 -------------------------------------------------------
package main

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        chilkat.#
                fmt.Println(http.Version())

}
2018/11/15 00:20:33 -------------------------------------------------------
2018/11/15 00:20:33 Error parsing input file (outer block):
2018/11/15 00:20:33  d:\Go\src\example\main.go:20:10: expected selector or typeassertion, found ';'
2018/11/15 00:20:33  d:\Go\src\example\main.go:21:3: expected ';', found fmt
2018/11/15 00:20:33  d:\Go\src\example\main.go:23:4: expected ';', found 'EOF'
2018/11/15 00:20:33  d:\Go\src\example\main.go:23:4: expected '}', found 'EOF'
2018/11/15 00:20:33 gbimporter: no package found for [chilkat can't find import: "chilkat"]: %!v(MISSING)
2018/11/15 00:20:33 Elapsed duration: 5.0007ms
2018/11/15 00:20:33 Offset: 0
2018/11/15 00:20:33 Number of candidates found: 0
2018/11/15 00:20:33 Candidates are:
2018/11/15 00:20:33 =======================================================
2018/11/15 00:20:33 Got autocompletion request for 'd:\Go\src\example\main.go'
2018/11/15 00:20:33 Cursor at: 406
2018/11/15 00:20:33 -------------------------------------------------------
package main
import "chilkat"

import (
        "chilkat"
        "fmt"
)

func main() {

        glob := chilkat.NewGlobal()
        success := glob.UnlockBundle("Anything for 30-day trial")
        if success != true {
                fmt.Println(glob.LastErrorText())
                return
        }

        //  Let's use the ECDSA private key at https://www.chilkatsoft.com/exampleData/secp256r1-key.zip
        //  for signing.
        http := chilkat.NewHttp()
        chilkat.#
                fmt.Println(http.Version())

}
2018/11/15 00:20:33 -------------------------------------------------------
2018/11/15 00:20:33 Error parsing input file (outer block):
2018/11/15 00:20:33  d:\Go\src\example\main.go:21:10: expected selector or typeassertion, found ';'
2018/11/15 00:20:33  d:\Go\src\example\main.go:22:3: expected ';', found fmt
2018/11/15 00:20:33  d:\Go\src\example\main.go:24:4: expected ';', found 'EOF'
2018/11/15 00:20:33  d:\Go\src\example\main.go:24:4: expected '}', found 'EOF'
2018/11/15 00:20:33 gbimporter: no package found for [chilkat can't find import: "chilkat"]: %!v(MISSING)
2018/11/15 00:20:33 Elapsed duration: 5.0006ms
2018/11/15 00:20:33 Offset: 0
2018/11/15 00:20:33 Number of candidates found: 0
2018/11/15 00:20:33 Candidates are:
2018/11/15 00:20:33 =======================================================

Hm, looks like gcexportdata.Read can't find your export data files. What is the output of tree $GOPATH/pkg?

Also, the -fallback-to-source flag only works on the client-side, so you'd have to start a server with gocode -s -cache -debug and then send a request through the command line like gocode -fallback-to-source -in d:\Go\src\example\main.go autocomplete d:\Go\src\example\main.go 406.

Along with this, isn't it weird that older version with same environment works but newest binary can't?

My guess is that the old version was always falling back to using source code, which is why you never noticed it was broken. It has probably been broken for some time, and I imagine it was fairly slow.

I'm afraid I don't understand the output of your tree command - this is the contents of $GOPATH/pkg? You had mentioned earlier that the chilkat.a files were in this directory, but I'm not seeing them in your gist - where are they located? Are you using dep?

I have edited file and updated gist. See here: https://gist.github.com/gencer/55e0875df154625b98e494645bfd87d8#file-tree-log-L3

Previous gist was only folders. Log file is very long so i only attached one folder.

Yes, I am using dep.

But you said there is a fallback source feature exists in latest version. I would expect that it will fallback to source and show me the suggestions if cache is not present.

Btw, to be clear, this "chilkat" is just an example. I tested on every project (without chilkat, plain project tree). No autocomplete at all. Only old binary works perfectly.

In addition to my previous comment, I would like to give you one more example.

Please see here: https://gist.github.com/gencer/55e0875df154625b98e494645bfd87d8#file-tree-log-L159

As you can see there is a models.a as it is a folder/package in my project.

This is new binary behavior: (master)
image

gocode shows me "models" and enter does not work. It just shows "models". Not in it. (it is imported)

This is old binary behavior:

image

and old binary output: (gocode -s -debug)

2018/11/15 10:49:11 -------------------------------------------------------
2018/11/15 10:49:11 Error parsing input file (outer block):
2018/11/15 10:49:11  d:\Go\src\gitsby-distributer\database.go:592:9: expected selector or type assertion, found ';'
2018/11/15 10:49:11 Elapsed duration: 54.0123ms
2018/11/15 10:49:11 Offset: 0
2018/11/15 10:49:11 Number of candidates found: 164
2018/11/15 10:49:11 Candidates are:
2018/11/15 10:49:11   func AccessExists(exec boil.Executor, iD int64) (bool, error)
2018/11/15 10:49:11   func AccessExistsG(iD int64) (bool, error)
2018/11/15 10:49:11   func Accesses(mods ...qm.QueryMod) models.accessQuery
2018/11/15 10:49:11   func ActionExists(exec boil.Executor, iD int64) (bool, error)
2018/11/15 10:49:11   func ActionExistsG(iD int64) (bool, error)
2018/11/15 10:49:11   func Actions(mods ...qm.QueryMod) models.actionQuery
2018/11/15 10:49:11   func AddAccessHook(hookPoint boil.HookPoint, access

The problem is probably that you are using dep (see nsf#491). Your previous gist included the dep directory, so if you have your .a files in there, gocode will not see them. Building with -i or doing go install ./vendor/... in your project directory should fix this.

Though, based on your gist, it also looks like you have the expected .a files in your windows_amd64 directory, which is the expected one. To clarify, is your directory really called D:\GO\PKG? I think it would be expected to be a lower-case pkg. I will try to add some more logging to the function that finds export data so we can more clearly see what's going on.

You can also use the -source flag, which needs to be sent in on each request. Some editors (such as Vim) allow you to configure the source flag. However, VSCode doesn't have this feature until the most recent version, as I mentioned earlier. You can test if the -source flag will work for you by starting a gocode server (gocode -s -debug) and then sending requests directly (gocode -in path/to/file.go -source autocomplete path/to/file.go <cursor position>.

In the meantime, you can also just sync to the version that works for you and use that.

commented

I have the same problam. use command gocode -s -debug then output

        charset := viper.GetString("mysql.charset")
        x := viper.#
}
2018/12/20 15:34:03 -------------------------------------------------------
2018/12/20 15:34:03 Error parsing input file (outer block):
2018/12/20 15:34:03  e:\Go\src\github.com\dota2mm\go-mega\config\g.go:36:13: expected selector or type assertion, found ';'
2018/12/20 15:34:03 gbimporter: no package found for github.com/spf13/viper: can't find import: "github.com/spf13/viper"
2018/12/20 15:34:03 Elapsed duration: 9.0012ms
2018/12/20 15:34:03 Offset: 0
2018/12/20 15:34:03 Number of candidates found: 0
2018/12/20 15:34:03 Candidates are:
2018/12/20 15:34:03 =======================================================

go version: 1.11.2
vscode version: 1.30.0

@DOTA2mm, I think your issue here is because viper package is not found. Aside from my issue, which all packages already installed, yours seems to be not.

Do you use dep? If so use dep ensure or install this viper package manually. Because gbimporter can't find it.

Update: Please also use older version of this tool. New version has already many problems with dep-based systems.

Also for a fix for dep, try this:

$ cd ./source-dir
$ dep ensure
$ go install ./vendor/...

Use latest gocode from this repository and everything will be fine.

commented

@DOTA2mm, I think your issue here is because viper package is not found. Aside from my issue, which all packages already installed, yours seems to be not.

Do you use dep? If so use dep ensure or install this viper package manually. Because gbimporter can't find it.

Update: Please also use older version of this tool. New version has already many problems with dep-based systems.

Also for a fix for dep, try this:

$ cd ./source-dir
$ dep ensure
$ go install ./vendor/...

Use latest gocode from this repository and everything will be fine.

Thanks reply.
Actually I have installed the viper package.
I think the key error message is expected selector or type assertion, found ';',this is very similar to your issues.
I hope the author can fix this problem as soon as possible.

@DOTA2mm: The error you mentioned above is actually not the problem, it's basically just saying that x := viper. is not a valid selector expression, but gocode still works on files that do not parse correctly.

The main issue is that gocode does not really work with dep. I am not actively adding features to gocode, but I am willing to accept PRs for this, so I will change the title of this issue and perhaps someone might have time to address it.

As @gencer said, running go install ./vendor/.. should be a workaround for this problem. Basically, you need to have a .a file for viper in your $GOPATH/pkg folder (something like $GOPATH/pkg/<os>_<arch>/github.com/spf13/viper.a).

commented

@stamblerre Thanks reply.
I did not use dep to manage the package, and also viper in my $GOPATH/pkg folder.
I tried manually enabling gocode-gomod in $GOPATH/bin than gocode works fine.

Envirment information is
go version go1.11.2 windows/amd64
vscode 1.30.0


I think it should be related to vscode-go

@DOTA2mm: I'm not sure I understand the issue. If you are using modules, VSCode-Go will use gocode-gomod, which is the module-aware version of gocode (stamblerre/gocode). If you are not using modules, then VSCode will use this version of gocode, which will just be named gocode.

Closing this issue, as the repository is in maintenance mode, and the recommended autocompletion provider for Go modules is gopls. Any PRs to handle support for dep are welcome.