Skip to content

x/tools/gopls: invoking source.addTest from CLI fails with ENOENT #70718

@adonovan

Description

@adonovan

While working on https://go.dev/cl/634197, I tried the new "Add test for function 'fingerprint'" code action within Emacs+eglot, and got an unhelpful "Internal error". I tried it again from the gopls CLI, and got a different error:

$ gopls codeaction -kind=source.addTest -exec ./gopls/internal/cache/methodsets/fingerprint.go:54
gopls: edits not applied because of getFile: file:///Users/adonovan/w/xtools/gopls/internal/cache/methodsets/fingerprint_test.go: open /Users/adonovan/w/xtools/gopls/internal/cache/methodsets/fingerprint_test.go: no such file or directory

Then I tried it from VS Code, and it worked great. (That said, the code action was not visible in the Command-. quick menu, and had to be selected from the right-click > Source Actions... menu. We should reinvestigate the endlessly fiddly algorithm that governs this.)

So, I don't think there's a bug in gopls' Code Action or command handler, but there is in the CLI, and in Eglot, and perhaps they are related.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions