Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete packages names? #41

Closed
Deleplace opened this issue Jul 11, 2017 · 5 comments · Fixed by #44
Closed

Complete packages names? #41

Deleplace opened this issue Jul 11, 2017 · 5 comments · Fixed by #44

Comments

@Deleplace
Copy link
Contributor

Hello, I am pretty exicted by the "Complete packages names" feature, which is exactly what I'm looking for.
I assume it should work on any fully qualified package name that resides inside $GOPATH (which would default to ~/go if $GOPATH is not set).

Unfortunately, I couldn't make it work:
go build github.c🔂
go test github.com/gorilla/mu🔂

...no results. I have tried with and without GOPATH set, even after starting new bash.
Any idea?

@posener
Copy link
Owner

posener commented Jul 12, 2017

Hi,
Thanks for this issue,
This could be fix by adding the go paths to the searched directories here: https://github.com/posener/complete/blob/master/gocomplete/pkgs.go#L25
Do you want to fix this?

@Deleplace
Copy link
Contributor Author

Deleplace commented Jul 12, 2017 via email

@Deleplace
Copy link
Contributor Author

Thank you for this Eyal!
Sorry about taking much time on my side, I actually wrote some code to get this working, but the whole folder/package duality is hard to get right at first attempt. Your code is better and also gives great results on my linux bash.

@posener
Copy link
Owner

posener commented Jul 30, 2017

Thanks for the feedback, no worries.
I saw your fork and understood the difficulties, my code is too messy :-)

@Deleplace
Copy link
Contributor Author

Here are a few further remarks :

  • gocomplete now handles env var GOPATH, and is already aware that it may contain several directories 👍
  • I suspect (not 100% sure) that in the Windows world a multiple-dir GOPATH would have entries separated by os.PathListSeparator, not by ":"
  • the unit tests fail when GOPATH is not set
  • gocomplete doesn't seem to handle $HOME/go (resp. %USERPROFILE%\go) as default (implicit) gopath when env var GOPATH is not set.

The implicit default gopath (since 1.8, see rationale here) is a really super-extra-neat convention imo, we sure try to handle it.

Please expect a PR within 15mn, to address the 3 caveats.

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

Successfully merging a pull request may close this issue.

2 participants