nsf / gocode

An autocompletion daemon for the Go programming language
MIT License
5.01k stars 657 forks source link

expected selector or type assertion, found ';' #467

Closed parhamdoustdar closed 7 years ago

parhamdoustdar commented 7 years ago

Hi,

I have a file like this:

package main

import (
    "booking/oconf/oconfutil"
)

func main() {
    oconfutil.
}

As soon as I type in the ".", the geocode server which I've run in debug mode gets a request. However, even though all the paths in the debug output are correct, geocode cannot resolve the package. here is the output of debug:

2017/09/01 09:51:12 -------------------------------------------------------
2017/09/01 09:51:12 Import path "booking/oconf/oconfutil" was not resolved
2017/09/01 09:51:12 Gocode's build context is:
2017/09/01 09:51:12  GOROOT: /usr/local/Cellar/go/1.9/libexec
2017/09/01 09:51:12  GOPATH: /Users/pdoustdar/src/gopath/
2017/09/01 09:51:12  GOOS: darwin
2017/09/01 09:51:12  GOARCH: amd64
2017/09/01 09:51:12  BzlProjectRoot: ""
2017/09/01 09:51:12  GBProjectRoot: ""
2017/09/01 09:51:12  lib-path: ""
2017/09/01 09:51:12 Error parsing input file (inner block):
2017/09/01 09:51:12  4:12: expected selector or type assertion, found ';'
2017/09/01 09:51:12 extracted expression tokens: oconfutil
2017/09/01 09:51:12 Offset: 0
2017/09/01 09:51:12 Number of candidates found: 0
2017/09/01 09:51:12 Candidates are:
2017/09/01 09:51:12 =======================================================

I think the culprit is the error saying expected selector or type assertion, found ';', but I'm not sure.

Thanks a lot for the awesome library! <3

nsf commented 7 years ago

No, that parsing error is fine. It says: Import path "booking/oconf/oconfutil" was not resolved. It couldn't find your library. Gocode expects libraries being compiled and installed (usually with go install or go get). Make sure you compiled your booking/oconf/oconfutil with go install or something.

It's not geocode, it's gocode. It's not a library, it's a program.

parhamdoustdar commented 7 years ago

Thanks a lot for the lightning fast answer! :-)

Sorry for the typo – my screen reader acts weird sometimes and doesn't give me the audio cue that says Mac OS just fix what it thought was a spelling error. Hence, gocode ends up as geocode.

Also, thanks a lot for telling me about the need to actually install my local libraries. I did that, and it works flawlessly! Plus, it got me to read the code and understand where the ; error was coming from.

Just as an aside, I'm completely blind and use Emacs to code. Without your program, I would be in really bad trouble. Thanks for all the time you've helped me save.