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

x/tools/gopls: Code navigation and lsp doesn't work when using go.mod replace #33731

Closed
krasi-georgiev opened this issue Aug 20, 2019 · 5 comments
Closed
Labels
Milestone

Comments

@krasi-georgiev
Copy link

@krasi-georgiev krasi-georgiev commented Aug 20, 2019

go version go1.12.6 linux/amd64

Does this issue reproduce with the latest release? Yes

 gopls version
golang.org/x/tools/gopls v0.1.3
    golang.org/x/tools/gopls@v0.1.4-0.20190820033707-85edb9ef3283 h1:4RzCZ4grbWxufc4sDtqmkQ6criGdzTK41oyDOb7JnYQ=

As soon as you put something in the go.mod replace as

replace github.com/calvernaz/rak811 => ../local/rak811

The code navigation(clicking on the function name) still takes you to
github.com/calvernaz/rak811

If I change some code in ../local/rak811 LSB complains about errors as it uses the github.com/calvernaz/rak811 and ignores the replace directive.

@gopherbot gopherbot added this to the Unreleased milestone Aug 20, 2019
@gopherbot gopherbot added the gopls label Aug 20, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Aug 20, 2019

Thank you for filing a gopls issue! Please take a look at the Troubleshooting section of the gopls Wiki page, and make sure that you have provided all of the relevant information here.

@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Aug 20, 2019

Thanks for moving this issue! Just to confirm, are you opening VSCode at the module root (the directory that contains the go.mod file)?

@krasi-georgiev

This comment has been minimized.

Copy link
Author

@krasi-georgiev krasi-georgiev commented Aug 21, 2019

yes

@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Aug 24, 2019

Can you run the command gopls -rpc.trace -v check path/to/file.go when your code is in the state you described above (doesn't have errors, but gopls shows errors)?

@krasi-georgiev

This comment has been minimized.

Copy link
Author

@krasi-georgiev krasi-georgiev commented Aug 25, 2019

Thanks for this command, after running it I realized that I had a duplicate do.mod file in the subdir.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.