Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Accept import paths like golang_org/x/* #357

Merged
merged 2 commits into from
Jan 23, 2019
Merged

Conversation

chrismwendt
Copy link
Contributor

@chrismwendt chrismwendt commented Jan 23, 2019

Previously, go-langserver would log errors saying it could not find some golang_org/x/* packages:

error finding package "golang_org/x/net/http/httpguts": Get http://golang_org/x/net/http/httpguts?go-get=1: dial tcp: lookup golang_org on 192.168.65.1:53: no such host

This did not affect the language server as far as I can tell - it only caused some distracting error messages.

See golang/go#17326

return nil, err
}
d.ProjectRoot = strings.Replace(d.ProjectRoot, "github.com/golang/", "golang_org/x/", 1)
return d, nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is identical to the previous case, except the . has been replaced with _ in golang.org/x/

@emidoots
Copy link
Member

emidoots commented Jan 23, 2019

These dependencies are actually coming from the Go stdlib. In older Go versions (not master, but all currently published Go versions), it uses an old form of vendoring where they basically just copy the golang.org/x/ packages into $GOROOT/src under a golang_org/x/ import path.

https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/golang/go%24%40go1.11+golang_org

Since this is a form of vendoring, it means that your approach here could link someone to the latest version of an golang.org/x/ package while the one in use is actually that version around the time of the Go language server's release.

However, given we do not support multiple Go versions, we do not publish which Go version our langserver is using clearly anywhere, and the fact that these dependencies are very rare in practice (and are going away in Go 1.12), and 99% of users are unlikely to encounter them -- this LGTM as a method of suppressing the log noise.

Could you add some docs to the switch case to indicate the above?

@chrismwendt
Copy link
Contributor Author

Thanks for the additional note 👍 I summarized that in a little doc on each case.

@chrismwendt chrismwendt merged commit c855987 into master Jan 23, 2019
@chrismwendt chrismwendt deleted the fix-golang_org-errors branch January 23, 2019 06:21
@chrismwendt
Copy link
Contributor Author

Thanks, fixed in 6d238ad

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

Successfully merging this pull request may close these issues.

2 participants