Skip to content

x/tools/gopls: issue with named imports #38927

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

Closed
stamblerre opened this issue May 7, 2020 · 4 comments
Closed

x/tools/gopls: issue with named imports #38927

stamblerre opened this issue May 7, 2020 · 4 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@stamblerre
Copy link
Contributor

See the repro case here: https://github.com/atombender/gopls-issue-38403.

/cc @atombender

@gopherbot gopherbot added this to the Unreleased milestone May 7, 2020
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels May 7, 2020
@heschi
Copy link
Contributor

heschi commented May 8, 2020

I reduced the test case to these two files:

package mypkg

func One() {
}
package mypkg

import net_url "net/url"

func Two() *net_url.URL {
	return nil
}

One significant finding: if you save the second file while it's got the error, it actually gets rewritten to *url.URL. That strongly hints that the AST is getting messed with, possibly by an analyzer.

@heschi
Copy link
Contributor

heschi commented May 8, 2020

https://cs.opensource.google/go/tools/+/master:internal/lsp/source/types_format.go;l=381;drc=b8428586f46299aff9dbc7b128617219c087700f doesn't return the cloned node, so it falls through and returns the original.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/232990 mentions this issue: internal/lsp/source: fix cloneExpr for SelectorExprs

@golang golang locked and limited conversation to collaborators May 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants