Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Using Go-Plus with gb (http://getgb.io/) - Not picking up vendored path for autocomplete #325

Closed
conikeec opened this issue Dec 10, 2015 · 7 comments

Comments

@conikeec
Copy link

Listed is my settings as follows

  1. Installed Atom with go-plus and all necessary libraries

  2. Installed direnv (http://direnv.net/) environment switcher based on current project

  3. Created a project using gb (getgb.io)

  4. Added third party libraries using "gb vendor" which saves to vendor/pkg folder in $PWD

  5. Created a .envrc file based on direnv profile. Content is

    export GOOS=darwin
    export GOARCH=amd64
    gocode set lib-path $PWD/pkg/$GOOS_$GOARCH
    export GOPATH=$(PWD)/vendor:$GOPATH

  6. Initiated or executed "atom ." from $PWD to start the editor

  7. I am now attempting to autocomplete the vendored library and it fails.

Am I missing anything here?
Since I initiated "atom ." from the $PWD context with the switched environment variable with the vendored folder added, it should autocomplete.

Why isn't it doing so?
Is atom+go-plus overriding $GOPATH ?

Please enlighten?

@conikeec
Copy link
Author

Actually autocomplete is not working for any vendored package installed using "go get" as well.

@joefitzgerald
Copy link
Owner

Can you please paste the output from Packages > Go Plus > Display Go Information?
/cc @nsf

@nsf
Copy link

nsf commented Dec 10, 2015

gocode set lib-path $PWD/pkg/$GOOS_$GOARCH

Don't do that. Instead:

  1. Update gocode to the lastest version: go get -u github.com/nsf/gocode.
  2. Then close the daemon in case if it's running, so that the update takes place: gocode close.
  3. Then reset lib-path: gocode set lib-path "".
  4. Enable gb package lookup mode: gocode set package-lookup-mode gb.

@nsf
Copy link

nsf commented Dec 10, 2015

export GOOS=darwin
export GOARCH=amd64
export GOPATH=$(PWD)/vendor:$GOPATH

Don't do that as well. GOPATH is a fixed path, it shouldn't depend on PWD. gb tool doesn't use GOPATH at all.

@conikeec
Copy link
Author

Thanks for the detailed note @nsf . Works like a charm.
Thanks @joefitzgerald

@joefitzgerald
Copy link
Owner

🎉 Thanks, @nsf!

@jareddlc
Copy link

jareddlc commented Aug 29, 2017

I have a different issue (note: i do not have direnv installed).

Autocomplete is working, however whenever I save a go file go-plus outputs the following message:

cannot find package "github.com/aws/aws-sdk-go/aws" in any of:
/Users/[user]/go/src/github.com/[company]/[project]/vendor/github.com/aws/aws-sdk-go/aws (vendor tree)
/usr/local/go/src/github.com/aws/aws-sdk-go/aws (from $GOROOT)
/Users/[user]/go/src/github.com/aws/aws-sdk-go/aws (from $GOPATH)

here what I did to see if it would resolve my issue based on the comments above.

  • close atom
  • go get -u github.com/nsf/gocode
  • gocode close
  • gocode set lib-path ""
  • gocode set package-lookup-mode gb
  • open atom

if anyone has a solution, I would appreciate the steps needed to get this to work.

UPDATE - already reported here: #207

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants