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: gopls.go_get_package fails when adding a new dependency to a module in go.work #48941

Closed
hyangah opened this issue Oct 13, 2021 · 2 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

@hyangah
Copy link
Contributor

hyangah commented Oct 13, 2021

What version of Go are you using (go version)?

$ go version
devel go1.18-577bb7dba1 Mon Oct 11 17:02:03 2021 +0000

$ go version -m ~/go/bin/gopls
/Users/hakim/go/bin/gopls: devel go1.18-577bb7dba1 Mon Oct 11 17:02:03 2021 +0000
        path    golang.org/x/tools/gopls
        mod     golang.org/x/tools/gopls        v0.0.0-20211013045602-378b9e1d59e2      h1:QutluyTjcrb7R6+t3mFmk6LzqtnkF0hpEdgo+GRLowM=
        dep     github.com/BurntSushi/toml      v0.4.1  h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
        dep     github.com/google/go-cmp        v0.5.6  h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
        dep     github.com/sergi/go-diff        v1.1.0  h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
        dep     golang.org/x/mod        v0.4.2  h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
        dep     golang.org/x/sync       v0.0.0-20210220032951-036812b2e83c      h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
        dep     golang.org/x/sys        v0.0.0-20210809222454-d867a43fc93e      h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA=
        dep     golang.org/x/text       v0.3.7  h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
        dep     golang.org/x/tools      v0.1.8-0.20211013045602-378b9e1d59e2    h1:6noN/Vk2xkxdIgiw44mSfDnOiu64ruAGD1bvjjB123k=
        dep     golang.org/x/xerrors    v0.0.0-20200804184101-5ec99f83aff1      h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
        dep     honnef.co/go/tools      v0.2.0  h1:ws8AfbgTX3oIczLPNPCu5166oBg9ST2vNs0rcht+mDE=
        dep     mvdan.cc/gofumpt        v0.1.1  h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA=
        dep     mvdan.cc/xurls/v2       v2.3.0  h1:59Olnbt67UKpxF1EwVBopJvkSUBmgtb468E4GVWIZ1I=

What did you do?

--- go.work ---
go 1.18

directory (
        ./b
)

--- b/b.go ---
package b

import (
        _ "fmt"
)

--- b/go.mod ---
module b

go 1.17
  1. open b/b.go
  2. add `_ "golang.org/x/mod/modfile"
  3. observe diagnostics and code action "go get package golang.org/x/mod/modfile"
  4. trigger code action or Quick Fix.

What did you expect to see?

The package is imported and go.mod is updated.
Not sure what's the impact to other modules in the workspace if any, though.

What did you see instead?

Screen Shot 2021-10-13 at 10 49 29 AM

[Trace - 10:56:35.541 AM] Sending request 'initialize - (0)'.
Params: {"processId":66201,"clientInfo":{"name":"Visual Studio Code","version":"1.61.0"},"locale":"en-us","rootPath":"/Users/hakim/report","rootUri":"file:///Users/hakim/report","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport":{"valueSet":[1]}},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true,"semanticTokens":{"refreshSupport":true},"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":true}},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]},"codeDescriptionSupport":true,"dataSupport":true},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"insertTextModeSupport":{"valueSet":[1,2]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true},"contextSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true,"tagSupport":{"valueSet":[1]},"labelSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"disabledSupport":true,"dataSupport":true,"resolveSupport":{"properties":["edit"]},"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"honorsChangeAnnotations":false},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1,"honorsChangeAnnotations":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"dynamicRegistration":true},"semanticTokens":{"dynamicRegistration":true,"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"],"requests":{"range":true,"full":{"delta":true}},"multilineTokenSupport":false,"overlappingTokenSupport":false},"linkedEditingRange":{"dynamicRegistration":true}},"window":{"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"showDocument":{"support":true},"workDoneProgress":true},"general":{"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"markdown":{"parser":"marked","version":"1.1.0"}}},"initializationOptions":{},"trace":"off","workspaceFolders":[{"uri":"file:///Users/hakim/report","name":"report"}]}


[Trace - 10:56:35.543 AM] Received response 'initialize - (0)' in 1ms.
Result: {"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"completionProvider":{"triggerCharacters":["."],"completionItem":{}},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor.extract","refactor.rewrite","source.fixAll","source.organizeImports"]},"codeLensProvider":{},"documentLinkProvider":{},"workspaceSymbolProvider":true,"documentFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":""},"renameProvider":{"prepareProvider":true},"foldingRangeProvider":true,"executeCommandProvider":{"commands":["gopls.add_dependency","gopls.add_import","gopls.apply_fix","gopls.check_upgrades","gopls.gc_details","gopls.generate","gopls.generate_gopls_mod","gopls.go_get_package","gopls.list_known_packages","gopls.regenerate_cgo","gopls.remove_dependency","gopls.run_tests","gopls.start_debugging","gopls.test","gopls.tidy","gopls.toggle_gc_details","gopls.update_go_sum","gopls.upgrade_dependency","gopls.vendor","gopls.workspace_metadata"]},"callHierarchyProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}}},"serverInfo":{"name":"gopls","version":"{\"path\":\"golang.org/x/tools/gopls\",\"version\":\"v0.0.0-20211013045602-378b9e1d59e2\",\"sum\":\"h1:QutluyTjcrb7R6+t3mFmk6LzqtnkF0hpEdgo+GRLowM=\",\"deps\":[{\"path\":\"github.com/BurntSushi/toml\",\"version\":\"v0.4.1\",\"sum\":\"h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=\"},{\"path\":\"github.com/google/go-cmp\",\"version\":\"v0.5.6\",\"sum\":\"h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=\"},{\"path\":\"github.com/sergi/go-diff\",\"version\":\"v1.1.0\",\"sum\":\"h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=\"},{\"path\":\"golang.org/x/mod\",\"version\":\"v0.4.2\",\"sum\":\"h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=\"},{\"path\":\"golang.org/x/sync\",\"version\":\"v0.0.0-20210220032951-036812b2e83c\",\"sum\":\"h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=\"},{\"path\":\"golang.org/x/sys\",\"version\":\"v0.0.0-20210809222454-d867a43fc93e\",\"sum\":\"h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA=\"},{\"path\":\"golang.org/x/text\",\"version\":\"v0.3.7\",\"sum\":\"h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=\"},{\"path\":\"golang.org/x/tools\",\"version\":\"v0.1.8-0.20211013045602-378b9e1d59e2\",\"sum\":\"h1:6noN/Vk2xkxdIgiw44mSfDnOiu64ruAGD1bvjjB123k=\"},{\"path\":\"golang.org/x/xerrors\",\"version\":\"v0.0.0-20200804184101-5ec99f83aff1\",\"sum\":\"h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=\"},{\"path\":\"honnef.co/go/tools\",\"version\":\"v0.2.0\",\"sum\":\"h1:ws8AfbgTX3oIczLPNPCu5166oBg9ST2vNs0rcht+mDE=\"},{\"path\":\"mvdan.cc/gofumpt\",\"version\":\"v0.1.1\",\"sum\":\"h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA=\"},{\"path\":\"mvdan.cc/xurls/v2\",\"version\":\"v2.3.0\",\"sum\":\"h1:59Olnbt67UKpxF1EwVBopJvkSUBmgtb468E4GVWIZ1I=\"}]}"}}


[Trace - 10:56:35.690 AM] Sending notification 'initialized'.
Params: {}


[Trace - 10:56:35.690 AM] Sending notification 'textDocument/didOpen'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go","languageId":"go","version":1,"text":"package b\n\nimport (\n\t_ \"fmt\"\n\t_ \"golang.org/x/mod/modfile\"\n)\n"}}


[Trace - 10:56:35.692 AM] Received request 'window/workDoneProgress/create - (1)'.
Params: {"token":"5577006791947779410"}


[Trace - 10:56:35.694 AM] Sending response 'window/workDoneProgress/create - (1)' in 2ms.
Result: 


[Trace - 10:56:35.695 AM] Received notification '$/progress'.
Params: {"token":"5577006791947779410","value":{"kind":"begin","title":"Setting up workspace","message":"Loading packages..."}}


[Trace - 10:56:35.695 AM] Received request 'workspace/configuration - (2)'.
Params: {"items":[{"scopeUri":"file:///Users/hakim/report","section":"gopls"}]}


[Trace - 10:56:35.700 AM] Sending response 'workspace/configuration - (2)' in 5ms.
Result: [{}]


[Trace - 10:56:35.747 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2021/10/13 10:56:35 go env for /Users/hakim/report\n(root /Users/hakim/report/b)\n(go version go version devel go1.18-577bb7dba1 Mon Oct 11 17:02:03 2021 +0000 darwin/amd64)\n(valid build configuration = true)\n(build flags: [])\nGO111MODULE=\nGONOSUMDB=\nGOINSECURE=\nGOMOD=/dev/null\nGOPATH=/Users/hakim/go\nGOCACHE=/Users/hakim/Library/Caches/go-build\nGOPRIVATE=\nGOPROXY=https://proxy.golang.org,direct\nGOROOT=/Users/hakim/sdk/gotip\nGOMODCACHE=/Users/hakim/go/pkg/mod\nGONOPROXY=\nGOSUMDB=sum.golang.org\nGOFLAGS=\n\n"}


[Info  - 10:56:35 AM] 2021/10/13 10:56:35 go env for /Users/hakim/report
(root /Users/hakim/report/b)
(go version go version devel go1.18-577bb7dba1 Mon Oct 11 17:02:03 2021 +0000 darwin/amd64)
(valid build configuration = true)
(build flags: [])
GO111MODULE=
GONOSUMDB=
GOINSECURE=
GOMOD=/dev/null
GOPATH=/Users/hakim/go
GOCACHE=/Users/hakim/Library/Caches/go-build
GOPRIVATE=
GOPROXY=https://proxy.golang.org,direct
GOROOT=/Users/hakim/sdk/gotip
GOMODCACHE=/Users/hakim/go/pkg/mod
GONOPROXY=
GOSUMDB=sum.golang.org
GOFLAGS=


[Trace - 10:56:35.859 AM] Sending request 'textDocument/documentSymbol - (1)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go"}}


[Trace - 10:56:35.929 AM] Sending request 'textDocument/documentLink - (2)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go"}}


[Trace - 10:56:36.111 AM] Sending notification '$/cancelRequest'.
Params: {"id":1}


[Trace - 10:56:36.111 AM] Sending request 'textDocument/documentSymbol - (3)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go"}}


[Trace - 10:56:36.118 AM] Sending request 'textDocument/foldingRange - (4)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go"}}


[Trace - 10:56:36.258 AM] Sending request 'textDocument/codeLens - (5)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go"}}


[Trace - 10:56:36.603 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2021/10/13 10:56:36 go/packages.Load\n\tsnapshot=0\n\tdirectory=/Users/hakim/report/b\n\tquery=[b/... builtin]\n\tpackages=2\n"}


[Info  - 10:56:36 AM] 2021/10/13 10:56:36 go/packages.Load
	snapshot=0
	directory=/Users/hakim/report/b
	query=[b/... builtin]
	packages=2

[Trace - 10:56:36.651 AM] Received notification '$/progress'.
Params: {"token":"5577006791947779410","value":{"kind":"end","message":"Finished loading packages."}}


[Trace - 10:56:36.652 AM] Received request 'client/registerCapability - (3)'.
Params: {"registrations":[{"id":"workspace/didChangeWatchedFiles-0","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"**/*.*tmpl","kind":7},{"globPattern":"**/*.{go,mod,sum,work,tmpl}","kind":7}]}}]}


[Trace - 10:56:36.657 AM] Sending response 'client/registerCapability - (3)' in 4ms.
Result: 


[Trace - 10:56:36.714 AM] Received request 'client/registerCapability - (4)'.
Params: {"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"}]}


[Trace - 10:56:36.725 AM] Sending response 'client/registerCapability - (4)' in 11ms.
Result: 


[Error - Received] 10:56:36.726 AM #1 JSON RPC cancelled


[Trace - 10:56:37.130 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2021/10/13 10:56:37 go/packages.Load\n\tsnapshot=1\n\tdirectory=/Users/hakim/report/b\n\tquery=[file=/Users/hakim/report/b/b.go]\n\tpackages=1\n"}


[Trace - 10:56:37.130 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2021/10/13 10:56:37 b: no dep handle for golang.org/x/mod/modfile: no metadata for golang.org/x/mod/modfile\n\tsnapshot=1\n"}


[Trace - 10:56:37.130 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2021/10/13 10:56:37 go/packages.Load\n\tsnapshot=1\n\tpackage=\"b\"\n\tfiles=[/Users/hakim/report/b/b.go]\n"}


[Info  - 10:56:37 AM] 2021/10/13 10:56:37 go/packages.Load
	snapshot=1
	directory=/Users/hakim/report/b
	query=[file=/Users/hakim/report/b/b.go]
	packages=1

[Error - 10:56:37 AM] 2021/10/13 10:56:37 b: no dep handle for golang.org/x/mod/modfile: no metadata for golang.org/x/mod/modfile
	snapshot=1

[Info  - 10:56:37 AM] 2021/10/13 10:56:37 go/packages.Load
	snapshot=1
	package="b"
	files=[/Users/hakim/report/b/b.go]

[Trace - 10:56:37.145 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2021/10/13 10:56:37 go/packages.Load\n\tsnapshot=1\n\tpackage=\"b\"\n\tfiles=[/Users/hakim/report/b/b.go]\n"}


[Trace - 10:56:37.145 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2021/10/13 10:56:37 go/packages.Load\n\tsnapshot=1\n\tdirectory=/Users/hakim/report/b\n\tquery=[file=/Users/hakim/report/b/b.go]\n\tpackages=1\n"}


[Info  - 10:56:37 AM] 2021/10/13 10:56:37 go/packages.Load
	snapshot=1
	package="b"
	files=[/Users/hakim/report/b/b.go]

[Info  - 10:56:37 AM] 2021/10/13 10:56:37 go/packages.Load
	snapshot=1
	directory=/Users/hakim/report/b
	query=[file=/Users/hakim/report/b/b.go]
	packages=1

[Trace - 10:56:37.247 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2021/10/13 10:56:37 discovered missing identifiers: map[memRecordCycle:true pageBits:true]\n\tpackage=\"runtime\"\n"}


[Info  - 10:56:37 AM] 2021/10/13 10:56:37 discovered missing identifiers: map[memRecordCycle:true pageBits:true]
	package="runtime"

[Trace - 10:56:37.388 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/hakim/report/b/b.go","version":1,"diagnostics":[{"range":{"start":{"line":4,"character":3},"end":{"line":4,"character":29}},"severity":1,"code":"BrokenImport","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal?utm_source=gopls#BrokenImport"},"source":"compiler","message":"could not import golang.org/x/mod/modfile (no required module provides package \"golang.org/x/mod/modfile\")"}]}


[Trace - 10:56:37.391 AM] Received response 'textDocument/documentLink - (2)' in 1461ms.
Result: [{"range":{"start":{"line":3,"character":4},"end":{"line":3,"character":7}},"target":"https://pkg.go.dev/fmt?utm_source=gopls"},{"range":{"start":{"line":4,"character":4},"end":{"line":4,"character":28}},"target":"https://pkg.go.dev/golang.org/x/mod/modfile?utm_source=gopls"}]


[Trace - 10:56:37.391 AM] Received response 'textDocument/documentSymbol - (3)' in 1279ms.
Result: []


[Trace - 10:56:37.394 AM] Received response 'textDocument/foldingRange - (4)' in 1275ms.
Result: [{"startLine":2,"startCharacter":8,"endLine":4,"endCharacter":29,"kind":"imports"}]


[Trace - 10:56:37.394 AM] Received response 'textDocument/codeLens - (5)' in 1136ms.
Result: null


[Trace - 10:56:38.201 AM] Sending request 'textDocument/documentLink - (6)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go"}}


[Trace - 10:56:38.203 AM] Received response 'textDocument/documentLink - (6)' in 1ms.
Result: [{"range":{"start":{"line":3,"character":4},"end":{"line":3,"character":7}},"target":"https://pkg.go.dev/fmt?utm_source=gopls"},{"range":{"start":{"line":4,"character":4},"end":{"line":4,"character":28}},"target":"https://pkg.go.dev/golang.org/x/mod/modfile?utm_source=gopls"}]


[Trace - 10:56:39.642 AM] Sending request 'textDocument/hover - (7)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go"},"position":{"line":4,"character":25}}


[Trace - 10:56:39.643 AM] Received response 'textDocument/hover - (7)' in 0ms.
Result: null


[Trace - 10:56:39.838 AM] Sending request 'textDocument/hover - (8)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go"},"position":{"line":4,"character":24}}


[Trace - 10:56:39.838 AM] Received response 'textDocument/hover - (8)' in 0ms.
Result: null


[Trace - 10:56:40.009 AM] Sending request 'textDocument/codeAction - (9)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go"},"range":{"start":{"line":4,"character":3},"end":{"line":4,"character":29}},"context":{"diagnostics":[{"range":{"start":{"line":4,"character":3},"end":{"line":4,"character":29}},"message":"could not import golang.org/x/mod/modfile (no required module provides package \"golang.org/x/mod/modfile\")","code":"BrokenImport","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal?utm_source%3Dgopls#BrokenImport"},"severity":1,"source":"compiler"}],"only":["quickfix"]}}


[Trace - 10:56:40.010 AM] Received response 'textDocument/codeAction - (9)' in 1ms.
Result: [{"title":"go get package golang.org/x/mod/modfile","kind":"quickfix","diagnostics":[{"range":{"start":{"line":4,"character":3},"end":{"line":4,"character":29}},"severity":1,"code":"BrokenImport","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal?utm_source%3Dgopls#BrokenImport"},"source":"compiler","message":"could not import golang.org/x/mod/modfile (no required module provides package \"golang.org/x/mod/modfile\")"}],"edit":{},"command":{"title":"go get package golang.org/x/mod/modfile","command":"gopls.go_get_package","arguments":[{"URI":"file:///Users/hakim/report/b/b.go","Pkg":"golang.org/x/mod/modfile","AddRequire":true}]}}]


[Trace - 10:56:44.544 AM] Sending request 'workspace/executeCommand - (10)'.
Params: {"command":"gopls.go_get_package","arguments":[{"URI":"file:///Users/hakim/report/b/b.go","Pkg":"golang.org/x/mod/modfile","AddRequire":true}]}


[Trace - 10:56:44.544 AM] Received request 'window/workDoneProgress/create - (5)'.
Params: {"token":"8674665223082153551"}


[Trace - 10:56:44.545 AM] Sending response 'window/workDoneProgress/create - (5)' in 0ms.
Result: 


[Trace - 10:56:44.545 AM] Received notification '$/progress'.
Params: {"token":"8674665223082153551","value":{"kind":"begin","title":"Running go get","cancellable":true,"message":"Running..."}}


[Trace - 10:56:44.568 AM] Received notification '$/progress'.
Params: {"token":"8674665223082153551","value":{"kind":"end","message":"failed"}}


[Trace - 10:56:44.569 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2021/10/13 10:56:44 command error: err: exit status 1: stderr: go: -mod may only be set to readonly when in workspace mode, but it is set to \"mod\"\n\tRemove the -mod flag to use the default readonly value,\n\tor set -workfile=off to disable workspace mode.\n\n"}


[Error - 10:56:44 AM] 2021/10/13 10:56:44 command error: err: exit status 1: stderr: go: -mod may only be set to readonly when in workspace mode, but it is set to "mod"
	Remove the -mod flag to use the default readonly value,
	or set -workfile=off to disable workspace mode.


[Error - Received] 10:56:44.569 AM #10 err: exit status 1: stderr: go: -mod may only be set to readonly when in workspace mode, but it is set to "mod"
	Remove the -mod flag to use the default readonly value,
	or set -workfile=off to disable workspace mode.



[Error - 10:56:44 AM] Request workspace/executeCommand failed.
  Message: err: exit status 1: stderr: go: -mod may only be set to readonly when in workspace mode, but it is set to "mod"
	Remove the -mod flag to use the default readonly value,
	or set -workfile=off to disable workspace mode.

  Code: 0 
[Trace - 10:56:46.017 AM] Sending request 'textDocument/codeLens - (11)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go"}}


[Trace - 10:56:46.017 AM] Received response 'textDocument/codeLens - (11)' in 0ms.
Result: null


[Trace - 10:56:50.430 AM] Sending request 'textDocument/codeLens - (12)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go"}}


[Trace - 10:56:50.431 AM] Received response 'textDocument/codeLens - (12)' in 1ms.
Result: null


[Trace - 10:57:10.041 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2021/10/13 10:57:10 background imports cache refresh starting\n"}


[Info  - 10:57:10 AM] 2021/10/13 10:57:10 background imports cache refresh starting

[Trace - 10:57:13.101 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2021/10/13 10:57:13 background refresh finished after 3.089521973s\n"}


[Info  - 10:57:13 AM] 2021/10/13 10:57:13 background refresh finished after 3.089521973s

[Trace - 10:58:56.370 AM] Sending request 'textDocument/codeLens - (13)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go"}}


[Trace - 10:58:56.370 AM] Received response 'textDocument/codeLens - (13)' in 0ms.
Result: null


[Trace - 10:58:57.940 AM] Sending request 'textDocument/documentSymbol - (14)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/report/b/b.go"}}


[Trace - 10:58:57.941 AM] Received response 'textDocument/documentSymbol - (14)' in 1ms.
Result: []

@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 Oct 13, 2021
@gopherbot gopherbot added this to the Unreleased milestone Oct 13, 2021
@mvdan
Copy link
Member

mvdan commented Oct 13, 2021

Did you mean to finish writing the title? :)

@hyangah hyangah changed the title x/tools/gopls: adding a n x/tools/gopls: gopls.go_get_package fails when adding a new dependency to a module in go.work Oct 13, 2021
@stamblerre stamblerre modified the milestones: Unreleased, gopls/on-deck Oct 14, 2021
@findleyr findleyr modified the milestones: gopls/on-deck, gopls/v0.8.0 Feb 8, 2022
@findleyr findleyr modified the milestones: gopls/v0.8.0, gopls/v0.8.1 Feb 17, 2022
@gopherbot
Copy link

Change https://go.dev/cl/391518 mentions this issue: internal/lsp/cache: set GOWORK=off when mutating modfiles

@golang golang locked and limited conversation to collaborators Mar 10, 2023
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

5 participants