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 : Prompted with [cannot find package] error in first time import package #43276

Closed
NGPONG opened this issue Dec 19, 2020 · 3 comments
Closed

Comments

@NGPONG
Copy link

@NGPONG NGPONG commented Dec 19, 2020

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

$ go version go1.15.6 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

WSL, ubuntu 20.04
neovim, coc.nvim

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ngpong/.cache/go-build"
GOENV="/home/ngpong/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ngpong/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ngpong/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build249756604=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Prompted with [cannot find package] error in first time import package. E.g import "fmt" and prompted with [could not import fmt (cannot find package "fmt" in any of \ /usr/local/go/src/fmt (from $GOROOT) \ /home/ngpong/go/src/fmt (from $GOPATH))]

However, when I exit vim and re-enter, the error message disappears

What did you expect to see?

Don't prompted with [cannot find package] error when i import package in the fist time.

What did you see instead?

When I import some package in the first time, I received this error message in following pic

微信截图_20201219145344

However, when I re-enter vim, the error messages was disappears

微信截图_20201219145639

log

-logfile Output
[Trace - 14:23:40.914 PM] Sending request 'initialize - (0)'.
Params: {"processId":31296,"rootPath":"/home/ngpong/go/src/mine","rootUri":"file:///home/ngpong/go/src/mine","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional"},"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]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]}},"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]}},"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,"contextSupport":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"activeParameterSupport":true,"parameterInformation":{"labelOffsetSupport":true}}},"definition":{"dynamicRegistration":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]}},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true},"implementation":{"dynamicRegistration":true},"declaration":{"dynamicRegistration":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"selectionRange":{"dynamicRegistration":true}},"window":{"workDoneProgress":true}},"initializationOptions":{"usePlaceholders":true},"trace":"off","workspaceFolders":[{"uri":"file:///home/ngpong/go/src/mine","name":"mine"}],"clientInfo":{"name":"coc.nvim","version":"0.0.79"},"workDoneToken":"6568a714-9fcd-4259-844a-042d9b9c3ac5"}

[Trace - 14:23:40.915 PM] Received response 'initialize - (0)' in 1ms.
Result: {"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"completionProvider":{"triggerCharacters":["."]},"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.generate","gopls.fill_struct","gopls.regenerate_cgo","gopls.test","gopls.tidy","gopls.update_go_sum","gopls.undeclared_name","gopls.go_get_package","gopls.add_dependency","gopls.upgrade_dependency","gopls.remove_dependency","gopls.vendor","gopls.extract_variable","gopls.extract_function","gopls.gc_details","gopls.generate_gopls_mod"]},"callHierarchyProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}}},"serverInfo":{"name":"gopls","version":"{"path":"golang.org/x/tools/gopls","version":"v0.6.1","sum":"h1:vD171EDBkyUVyp9B45IYXklV/VEfbHgX0FKw0Q0dO30=","deps":[{"path":"github.com/BurntSushi/toml","version":"v0.3.1","sum":"h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ="},{"path":"github.com/google/go-cmp","version":"v0.5.1","sum":"h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k="},{"path":"github.com/sergi/go-diff","version":"v1.1.0","sum":"h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0="},{"path":"golang.org/x/mod","version":"v0.3.0","sum":"h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4="},{"path":"golang.org/x/sync","version":"v0.0.0-20201020160332-67f06af15bc9","sum":"h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck="},{"path":"golang.org/x/tools","version":"v0.0.0-20201217163546-c88dec5c6b05","sum":"h1:4hzTNH658xirWc4MvAx9HK2/2hY6z42i1+lRK8OzeJE="},{"path":"golang.org/x/xerrors","version":"v0.0.0-20200804184101-5ec99f83aff1","sum":"h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE="},{"path":"honnef.co/go/tools","version":"v0.0.1-2020.1.6","sum":"h1:W18jzjh8mfPez+AwGLxmOImucz/IFjpNlrKVnaj2YVc="},{"path":"mvdan.cc/gofumpt","version":"v0.0.0-20200927160801-5bfeb2e70dd6","sum":"h1:z+/YqapuV7VZPvBb3GYmuEJbA88M3PFUxaHilHYVCpQ="},{"path":"mvdan.cc/xurls/v2","version":"v2.2.0","sum":"h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A="}]}"}}

[Trace - 14:23:40.917 PM] Sending notification 'initialized'.
Params: {}

[Trace - 14:23:40.917 PM] Received request 'window/workDoneProgress/create - (1)'.
Params: {"token":"5577006791947779410"}

[Trace - 14:23:40.918 PM] Sending notification 'textDocument/didOpen'.
Params: {"textDocument":{"uri":"file:///home/ngpong/go/src/mine/main.go","languageId":"go","version":1,"text":"package main;\n"}}

[Trace - 14:23:40.923 PM] Sending response 'window/workDoneProgress/create - (1)' in 5ms.
Result:

[Trace - 14:23:40.923 PM] Received notification '$/progress'.
Params: {"token":"5577006791947779410","value":{"kind":"begin","title":"Setting up workspace","message":"Loading packages..."}}

[Trace - 14:23:40.923 PM] Received request 'workspace/configuration - (2)'.
Params: {"items":[{"scopeUri":"file:///home/ngpong/go/src/mine","section":"gopls"}]}

[Trace - 14:23:40.924 PM] Sending response 'workspace/configuration - (2)' in 0ms.
Result: [null]

[Trace - 14:23:41.032 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/12/20 14:23:41 go env for /home/ngpong/go/src/mine\n(root /home/ngpong/go/src/mine)\n(go version go version go1.15.6 linux/amd64)\n(valid build configuration = true)\n(build flags: [])\nGOPRIVATE=\nGOFLAGS=\nGOCACHE=/home/ngpong/.cache/go-build\nGOMODCACHE=/home/ngpong/go/pkg/mod\nGOPATH=/home/ngpong/go\nGOPROXY=https://proxy.golang.org,direct\nGO111MODULE=on\nGOSUMDB=sum.golang.org\nGOMOD=/dev/null\nGOINSECURE=\nGONOPROXY=\nGONOSUMDB=\nGOROOT=/usr/local/go\n\n"}

[Trace - 14:23:41.095 PM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2020/12/20 14:23:41 initial workspace load failed: go [-e -json -compiled=true -test=true -export=false -deps=true -find=false -- ./... builtin]: exit status 1: go: cannot find main module; see 'go help modules'\n: packages.Load error\n"}

[Trace - 14:23:41.095 PM] Received notification '$/progress'.
Params: {"token":"5577006791947779410","value":{"kind":"end","message":"Finished loading packages."}}

[Trace - 14:23:41.095 PM] Received request 'window/workDoneProgress/create - (4)'.
Params: {"token":"8674665223082153551"}

[Trace - 14:23:41.095 PM] Received request 'client/registerCapability - (3)'.
Params: {"registrations":[{"id":"workspace/didChangeWatchedFiles-0","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"**/*.{go,mod,sum}","kind":7}]}}]}

[Trace - 14:23:41.095 PM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2020/12/20 14:23:41 go/packages.Load: go [-e -json -compiled=true -test=true -export=false -deps=true -find=false -- ./... builtin]: exit status 1: go: cannot find main module; see 'go help modules'\n\n\tsnapshot=0\n\tdirectory=/home/ngpong/go/src/mine\n\tquery=[./... builtin]\n\tpackages=0\n"}

[Trace - 14:23:41.096 PM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2020/12/20 14:23:41 errors loading workspace: go [-e -json -compiled=true -test=true -export=false -deps=true -find=false -- ./... builtin]: exit status 1: go: cannot find main module; see 'go help modules'\n: packages.Load error\n\tsnapshot=0\n\tdirectory=file:///home/ngpong/go/src/mine\n"}

[Trace - 14:23:41.096 PM] Sending response 'window/workDoneProgress/create - (4)' in 0ms.
Result:

[Trace - 14:23:41.096 PM] Received notification '$/progress'.
Params: {"token":"8674665223082153551","value":{"kind":"begin","title":"Error loading workspace","message":"go [-e -json -compiled=true -test=true -export=false -deps=true -find=false -- ./... builtin]: exit status 1: go: cannot find main module; see 'go help modules' : packages.Load error"}}

[Trace - 14:23:41.101 PM] Sending response 'client/registerCapability - (3)' in 5ms.
Result:

[Trace - 14:23:41.102 PM] Received request 'client/registerCapability - (5)'.
Params: {"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"},{"id":"workspace/didChangeWorkspaceFolders","method":"workspace/didChangeWorkspaceFolders"}]}

[Trace - 14:23:41.102 PM] Sending response 'client/registerCapability - (5)' in 0ms.
Result:

[Trace - 14:23:41.275 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/12/20 14:23:41 go/packages.Load\n\tsnapshot=1\n\tdirectory=/home/ngpong/go/src/mine\n\tquery=[file=/home/ngpong/go/src/mine/main.go]\n\tpackages=1\n"}

[Trace - 14:23:41.275 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/12/20 14:23:41 go/packages.Load\n\tsnapshot=1\n\tpackage_path="command-line-arguments"\n\tfiles=[/home/ngpong/go/src/mine/main.go]\n"}

[Trace - 14:23:41.526 PM] Received notification '$/progress'.
Params: {"token":"8674665223082153551","value":{"kind":"end","message":"Done."}}

[Trace - 14:23:41.783 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":2,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":1,"character":0},"end":{"line":1,"character":0}},"rangeLength":0,"text":"\n"}]}

[Trace - 14:23:41.936 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":3,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":1,"character":0},"end":{"line":1,"character":0}},"rangeLength":0,"text":"\n"}]}

[Trace - 14:23:42.137 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":4,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"rangeLength":0,"text":"p"}]}

[Trace - 14:23:42.138 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":4,"diagnostics":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"severity":1,"source":"syntax","message":"expected declaration, found p"}]}

[Trace - 14:23:42.240 PM] Sending request 'textDocument/completion - (1)'.
Params: {"textDocument":{"uri":"file:///home/ngpong/go/src/mine/main.go"},"position":{"line":2,"character":1},"context":{"triggerKind":1}}

[Trace - 14:23:42.240 PM] Received response 'textDocument/completion - (1)' in 0ms.
Result: {"isIncomplete":false,"items":[]}

[Trace - 14:23:42.258 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":5,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":1},"end":{"line":2,"character":1}},"rangeLength":0,"text":"a"}]}

[Trace - 14:23:42.258 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":5,"diagnostics":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"severity":1,"source":"syntax","message":"expected declaration, found pa"}]}

[Trace - 14:23:42.382 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":6,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":2},"end":{"line":2,"character":2}},"rangeLength":0,"text":"c"}]}

[Trace - 14:23:42.383 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":6,"diagnostics":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"severity":1,"source":"syntax","message":"expected declaration, found pac"}]}

[Trace - 14:23:42.465 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":7,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":3},"end":{"line":2,"character":3}},"rangeLength":0,"text":"k"}]}

[Trace - 14:23:42.466 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":7,"diagnostics":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"severity":1,"source":"syntax","message":"expected declaration, found pack"}]}

[Trace - 14:23:42.565 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":8,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":4},"end":{"line":2,"character":4}},"rangeLength":0,"text":"a"}]}

[Trace - 14:23:42.566 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":8,"diagnostics":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"severity":1,"source":"syntax","message":"expected declaration, found packa"}]}

[Trace - 14:23:43.685 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":9,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":4},"end":{"line":2,"character":5}},"rangeLength":1,"text":""}]}

[Trace - 14:23:43.686 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":9,"diagnostics":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"severity":1,"source":"syntax","message":"expected declaration, found pack"}]}

[Trace - 14:23:43.814 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":10,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":3},"end":{"line":2,"character":4}},"rangeLength":1,"text":""}]}

[Trace - 14:23:43.816 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":10,"diagnostics":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"severity":1,"source":"syntax","message":"expected declaration, found pac"}]}

[Trace - 14:23:43.960 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":11,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":2},"end":{"line":2,"character":3}},"rangeLength":1,"text":""}]}

[Trace - 14:23:43.960 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":11,"diagnostics":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"severity":1,"source":"syntax","message":"expected declaration, found pa"}]}

[Trace - 14:23:44.080 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":12,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":1},"end":{"line":2,"character":2}},"rangeLength":1,"text":""}]}

[Trace - 14:23:44.081 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":12,"diagnostics":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"severity":1,"source":"syntax","message":"expected declaration, found p"}]}

[Trace - 14:23:44.206 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":13,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":1}},"rangeLength":1,"text":""}]}

[Trace - 14:23:44.207 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":13,"diagnostics":[]}

[Trace - 14:23:44.327 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":14,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"rangeLength":0,"text":"i"}]}

[Trace - 14:23:44.328 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":14,"diagnostics":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"severity":1,"source":"syntax","message":"expected declaration, found i"}]}

[Trace - 14:23:44.433 PM] Sending request 'textDocument/completion - (2)'.
Params: {"textDocument":{"uri":"file:///home/ngpong/go/src/mine/main.go"},"position":{"line":2,"character":1},"context":{"triggerKind":1}}

[Trace - 14:23:44.434 PM] Received response 'textDocument/completion - (2)' in 0ms.
Result: {"isIncomplete":true,"items":[{"label":"import","kind":14,"preselect":true,"sortText":"00000","filterText":"import","insertTextFormat":2,"textEdit":{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":1}},"newText":"import"}}]}

[Trace - 14:23:44.468 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":15,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":1},"end":{"line":2,"character":1}},"rangeLength":0,"text":"m"}]}

[Trace - 14:23:44.468 PM] Sending request 'textDocument/completion - (3)'.
Params: {"textDocument":{"uri":"file:///home/ngpong/go/src/mine/main.go"},"position":{"line":2,"character":2},"context":{"triggerKind":3}}

[Trace - 14:23:44.468 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":15,"diagnostics":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"severity":1,"source":"syntax","message":"expected declaration, found im"}]}

[Trace - 14:23:44.469 PM] Received response 'textDocument/completion - (3)' in 0ms.
Result: {"isIncomplete":true,"items":[{"label":"import","kind":14,"preselect":true,"sortText":"00000","filterText":"import","insertTextFormat":2,"textEdit":{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":2}},"newText":"import"}}]}

[Trace - 14:23:44.614 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":16,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":2},"end":{"line":2,"character":2}},"rangeLength":0,"text":"p"}]}

[Trace - 14:23:44.614 PM] Sending request 'textDocument/completion - (4)'.
Params: {"textDocument":{"uri":"file:///home/ngpong/go/src/mine/main.go"},"position":{"line":2,"character":3},"context":{"triggerKind":3}}

[Trace - 14:23:44.615 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":16,"diagnostics":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"severity":1,"source":"syntax","message":"expected declaration, found imp"}]}

[Trace - 14:23:44.615 PM] Received response 'textDocument/completion - (4)' in 0ms.
Result: {"isIncomplete":true,"items":[{"label":"import","kind":14,"preselect":true,"sortText":"00000","filterText":"import","insertTextFormat":2,"textEdit":{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":3}},"newText":"import"}}]}

[Trace - 14:23:44.739 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":17,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":3},"end":{"line":2,"character":3}},"rangeLength":0,"text":"o"}]}

[Trace - 14:23:44.739 PM] Sending request 'textDocument/completion - (5)'.
Params: {"textDocument":{"uri":"file:///home/ngpong/go/src/mine/main.go"},"position":{"line":2,"character":4},"context":{"triggerKind":3}}

[Trace - 14:23:44.739 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":17,"diagnostics":[{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":0}},"severity":1,"source":"syntax","message":"expected declaration, found impo"}]}

[Trace - 14:23:44.739 PM] Received response 'textDocument/completion - (5)' in 0ms.
Result: {"isIncomplete":true,"items":[{"label":"import","kind":14,"preselect":true,"sortText":"00000","filterText":"import","insertTextFormat":2,"textEdit":{"range":{"start":{"line":2,"character":0},"end":{"line":2,"character":4}},"newText":"import"}}]}

[Trace - 14:23:44.889 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":18,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":4},"end":{"line":2,"character":4}},"rangeLength":0,"text":"rt"}]}

[Trace - 14:23:44.890 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":18,"diagnostics":[{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":0}},"severity":1,"source":"syntax","message":"expected ';', found 'EOF'"}]}

[Trace - 14:23:45.252 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":19,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":6},"end":{"line":2,"character":6}},"rangeLength":0,"text":" "}]}

[Trace - 14:23:45.439 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":20,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":7}},"rangeLength":0,"text":"""}]}

[Trace - 14:23:45.439 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":20,"diagnostics":[{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":7}},"severity":1,"source":"syntax","message":"invalid import path: ""}]}

[Trace - 14:23:45.655 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":21,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":8},"end":{"line":2,"character":8}},"rangeLength":0,"text":"f"}]}

[Trace - 14:23:45.656 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":21,"diagnostics":[{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":7}},"severity":1,"source":"syntax","message":"invalid import path: "f"}]}

[Trace - 14:23:45.756 PM] Sending request 'textDocument/completion - (6)'.
Params: {"textDocument":{"uri":"file:///home/ngpong/go/src/mine/main.go"},"position":{"line":2,"character":9},"context":{"triggerKind":1}}

[Trace - 14:23:45.768 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":22,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":9},"end":{"line":2,"character":9}},"rangeLength":0,"text":"m"}]}

[Trace - 14:23:45.834 PM] Received response 'textDocument/completion - (6)' in 77ms.
Result: {"isIncomplete":true,"items":[{"label":"flag"","kind":9,"detail":""flag"","preselect":true,"sortText":"00000","filterText":"flag"","insertTextFormat":2,"textEdit":{"range":{"start":{"line":2,"character":8},"end":{"line":2,"character":9}},"newText":"flag""}},{"label":"fmt"","kind":9,"detail":""fmt"","sortText":"00001","filterText":"fmt"","insertTextFormat":2,"textEdit":{"range":{"start":{"line":2,"character":8},"end":{"line":2,"character":9}},"newText":"fmt""}}]}

[Trace - 14:23:45.834 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":22,"diagnostics":[{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":7}},"severity":1,"source":"syntax","message":"invalid import path: "fm"}]}

[Trace - 14:23:45.835 PM] Sending request 'textDocument/completion - (7)'.
Params: {"textDocument":{"uri":"file:///home/ngpong/go/src/mine/main.go"},"position":{"line":2,"character":10},"context":{"triggerKind":3}}

[Trace - 14:23:45.835 PM] Received response 'textDocument/completion - (7)' in 0ms.
Result: {"isIncomplete":true,"items":[{"label":"fmt"","kind":9,"detail":""fmt"","preselect":true,"sortText":"00000","filterText":"fmt"","insertTextFormat":2,"textEdit":{"range":{"start":{"line":2,"character":8},"end":{"line":2,"character":10}},"newText":"fmt""}}]}

[Trace - 14:23:46.348 PM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":23,"uri":"file:///home/ngpong/go/src/mine/main.go"},"contentChanges":[{"range":{"start":{"line":2,"character":10},"end":{"line":2,"character":10}},"rangeLength":0,"text":"t""}]}

[Trace - 14:23:46.555 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/12/20 14:23:46 go/packages.Load\n\tsnapshot=23\n\tdirectory=/home/ngpong/go/src/mine\n\tquery=[file=/home/ngpong/go/src/mine/main.go]\n\tpackages=1\n"}

[Trace - 14:23:46.555 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/12/20 14:23:46 go/packages.Load\n\tsnapshot=23\n\tpackage_path="command-line-arguments"\n\tfiles=[/home/ngpong/go/src/mine/main.go]\n"}

[Trace - 14:23:46.555 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/ngpong/go/src/mine/main.go","version":23,"diagnostics":[{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":12}},"severity":1,"source":"compiler","message":""fmt" imported but not used"},{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":12}},"severity":1,"source":"compiler","message":"could not import fmt (cannot find package "fmt" in any of \n\t/usr/local/go/src/fmt (from $GOROOT)\n\t/home/ngpong/go/src/fmt (from $GOPATH))"}]}

[Trace - 14:23:47.160 PM] Sending notification 'textDocument/didSave'.
Params: {"textDocument":{"uri":"file:///home/ngpong/go/src/mine/main.go","version":23}}

[Trace - 14:23:49.505 PM] Sending notification 'textDocument/didSave'.
Params: {"textDocument":{"uri":"file:///home/ngpong/go/src/mine/main.go","version":23}}

[Trace - 14:23:49.507 PM] Sending notification 'textDocument/didClose'.
Params: {"textDocument":{"uri":"file:///home/ngpong/go/src/mine/main.go"}}

@gopherbot gopherbot added this to the Unreleased milestone Dec 19, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Dec 21, 2020

It looks like you have set GO111MODULE=on, but you are working in your GOPATH. Does setting GO111MODULE=auto or initializing a module resolve the problem?

@NGPONG
Copy link
Author

@NGPONG NGPONG commented Dec 22, 2020

It looks like you have set GO111MODULE=on, but you are working in your GOPATH. Does setting GO111MODULE=auto or initializing a module resolve the problem?

Dosen't work, But I found that if the go.mod file exists in the current directory, gopls will run as expected

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Dec 22, 2020

Yep, initializing a module should resolve the issue. Ok to close this?

@stamblerre stamblerre closed this Dec 22, 2020
@stamblerre stamblerre removed this from the gopls/v1.0.0 milestone Dec 23, 2020
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