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/cmd/gopls: CL 178724 results in "no package found" parse error #32354

Closed
myitcv opened this issue May 31, 2019 · 17 comments
Closed

x/tools/cmd/gopls: CL 178724 results in "no package found" parse error #32354

myitcv opened this issue May 31, 2019 · 17 comments

Comments

@myitcv
Copy link
Member

@myitcv myitcv commented May 31, 2019

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

$ go version
go version devel +385b2e0cac Fri May 24 21:34:53 2019 +0000 linux/amd64
$ go list -m golang.org/x/tools
golang.org/x/tools v0.0.0-20190530184349-ce1a3806b557

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/home/myitcv/gostuff/src/github.com/myitcv/govim/cmd/govim/.bin"
GOCACHE="/home/myitcv/.cache/go-build"
GOENV="/home/myitcv/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GOPROXY="https://proxy.golang.org/"
GOROOT="/home/myitcv/gos"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/myitcv/gostuff/src/github.com/myitcv/govim/go.mod"
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-build347064954=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I have a test that passes normally, but fails following https://go-review.googlesource.com/c/tools/+/178724; the error message I get back is:

unable to check package for file:///tmp/go-test-script992386908/script-complete_watched/const.go: parse: no package found for /tmp/go-test-script992386908/script-complete_watched/const.go

The test is https://github.com/myitcv/govim/blob/latest_tools/cmd/govim/testdata/complete_watched.txt. The scope of the test is roughly:

  • load main.go in Vim
  • wait for diagnostics for main.go
  • change a file (const.go) that is not loaded in Vim (but watched via a govim file watcher); the govim file watcher then calls didOpen/didChange as required
  • wait for diagnostics for const.go
  • attempt completion that depends on the contents of const.go

Following https://go-review.googlesource.com/c/tools/+/178724, however, I now get an error back when the govim file watcher first tells gopls about the file via didOpen:

unable to check package for file:///tmp/go-test-script992386908/script-complete_watched/const.go: parse: no package found for /tmp/go-test-script992386908/script-complete_watched/const.go

But as you can see from the log, the file contents sent to gopls are valid Go.

govim log
gopls server start =======================
gopls.Initialize() call; params:
&protocol.InitializeParams{
    ProcessID:    0,
    RootPath:     "",
    RootURI:      "file:///tmp/go-test-script020120554/script-complete_watched",
    Capabilities: protocol.ClientCapabilities{
        Workspace: struct { ApplyEdit bool "json:\"applyEdit,omitempty\""; WorkspaceEdit struct { DocumentChanges bool "json:\"documentChanges,omitempty\""; ResourceOperations []protocol.ResourceOperationKind "json:\"resourceOperations,omitempty\""; FailureHandling protocol.FailureHandlingKind "json:\"failureHandling,omitempty\"" } "json:\"workspaceEdit,omitempty\""; DidChangeConfiguration struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" } "json:\"didChangeConfiguration,omitempty\""; DidChangeWatchedFiles struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" } "json:\"didChangeWatchedFiles,omitempty\""; Symbol struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; SymbolKind struct { ValueSet []protocol.SymbolKind "json:\"valueSet,omitempty\"" } "json:\"symbolKind,omitempty\"" } "json:\"symbol,omitempty\""; ExecuteCommand struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" } "json:\"executeCommand,omitempty\""; WorkspaceFolders bool "json:\"workspaceFolders,omitempty\""; Configuration bool "json:\"configuration,omitempty\"" }{
            ApplyEdit:              false,
            WorkspaceEdit:          struct { DocumentChanges bool "json:\"documentChanges,omitempty\""; ResourceOperations []protocol.ResourceOperationKind "json:\"resourceOperations,omitempty\""; FailureHandling protocol.FailureHandlingKind "json:\"failureHandling,omitempty\"" }{},
            DidChangeConfiguration: struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" }{DynamicRegistration:true},
            DidChangeWatchedFiles:  struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" }{},
            Symbol:                 struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; SymbolKind struct { ValueSet []protocol.SymbolKind "json:\"valueSet,omitempty\"" } "json:\"symbolKind,omitempty\"" }{},
            ExecuteCommand:         struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" }{},
            WorkspaceFolders:       false,
            Configuration:          true,
        },
        TextDocument: struct { Synchronization struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; WillSave bool "json:\"willSave,omitempty\""; WillSaveWaitUntil bool "json:\"willSaveWaitUntil,omitempty\""; DidSave bool "json:\"didSave,omitempty\"" } "json:\"synchronization,omitempty\""; Completion struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; CompletionItem struct { SnippetSupport bool "json:\"snippetSupport,omitempty\""; CommitCharactersSupport bool "json:\"commitCharactersSupport,omitempty\""; DocumentationFormat []protocol.MarkupKind "json:\"documentationFormat,omitempty\""; DeprecatedSupport bool "json:\"deprecatedSupport,omitempty\""; PreselectSupport bool "json:\"preselectSupport,omitempty\"" } "json:\"completionItem,omitempty\""; CompletionItemKind struct { ValueSet []protocol.CompletionItemKind "json:\"valueSet,omitempty\"" } "json:\"completionItemKind,omitempty\""; ContextSupport bool "json:\"contextSupport,omitempty\"" } "json:\"completion,omitempty\""; Hover struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; ContentFormat []protocol.MarkupKind "json:\"contentFormat,omitempty\"" } "json:\"hover,omitempty\""; SignatureHelp struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; SignatureInformation struct { DocumentationFormat []protocol.MarkupKind "json:\"documentationFormat,omitempty\""; ParameterInformation struct { LabelOffsetSupport bool "json:\"labelOffsetSupport,omitempty\"" } "json:\"parameterInformation,omitempty\"" } "json:\"signatureInformation,omitempty\"" } "json:\"signatureHelp,omitempty\""; References struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" } "json:\"references,omitempty\""; DocumentHighlight struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" } "json:\"documentHighlight,omitempty\""; DocumentSymbol struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; SymbolKind struct { ValueSet []protocol.SymbolKind "json:\"valueSet,omitempty\"" } "json:\"symbolKind,omitempty\""; HierarchicalDocumentSymbolSupport bool "json:\"hierarchicalDocumentSymbolSupport,omitempty\"" } "json:\"documentSymbol,omitempty\""; Formatting struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" } "json:\"formatting,omitempty\""; RangeFormatting struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" } "json:\"rangeFormatting,omitempty\""; OnTypeFormatting struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" } "json:\"onTypeFormatting,omitempty\""; Definition struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; LinkSupport bool "json:\"linkSupport,omitempty\"" } "json:\"definition,omitempty\""; CodeAction struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; CodeActionLiteralSupport struct { CodeActionKind struct { ValueSet []protocol.CodeActionKind "json:\"valueSet\"" } "json:\"codeActionKind\"" } "json:\"codeActionLiteralSupport,omitempty\"" } "json:\"codeAction,omitempty\""; CodeLens struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" } "json:\"codeLens,omitempty\""; DocumentLink struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" } "json:\"documentLink,omitempty\""; Rename struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; PrepareSupport bool "json:\"prepareSupport,omitempty\"" } "json:\"rename,omitempty\""; PublishDiagnostics struct { RelatedInformation bool "json:\"relatedInformation,omitempty\""; TagSupport bool "json:\"tagSupport,omitempty\"" } "json:\"publishDiagnostics,omitempty\""; Implementation struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; LinkSupport bool "json:\"linkSupport,omitempty\"" } "json:\"implementation,omitempty\""; TypeDefinition struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; LinkSupport bool "json:\"linkSupport,omitempty\"" } "json:\"typeDefinition,omitempty\""; ColorProvider struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" } "json:\"colorProvider,omitempty\""; FoldingRange struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; RangeLimit float64 "json:\"rangeLimit,omitempty\""; LineFoldingOnly bool "json:\"lineFoldingOnly,omitempty\"" } "json:\"foldingRange,omitempty\""; Declaration struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; LinkSupport bool "json:\"linkSupport,omitempty\"" } "json:\"declaration,omitempty\"" }{
            Synchronization: struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; WillSave bool "json:\"willSave,omitempty\""; WillSaveWaitUntil bool "json:\"willSaveWaitUntil,omitempty\""; DidSave bool "json:\"didSave,omitempty\"" }{},
            Completion:      struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; CompletionItem struct { SnippetSupport bool "json:\"snippetSupport,omitempty\""; CommitCharactersSupport bool "json:\"commitCharactersSupport,omitempty\""; DocumentationFormat []protocol.MarkupKind "json:\"documentationFormat,omitempty\""; DeprecatedSupport bool "json:\"deprecatedSupport,omitempty\""; PreselectSupport bool "json:\"preselectSupport,omitempty\"" } "json:\"completionItem,omitempty\""; CompletionItemKind struct { ValueSet []protocol.CompletionItemKind "json:\"valueSet,omitempty\"" } "json:\"completionItemKind,omitempty\""; ContextSupport bool "json:\"contextSupport,omitempty\"" }{},
            Hover:           struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; ContentFormat []protocol.MarkupKind "json:\"contentFormat,omitempty\"" }{
                DynamicRegistration: false,
                ContentFormat:       {"plaintext"},
            },
            SignatureHelp:      struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; SignatureInformation struct { DocumentationFormat []protocol.MarkupKind "json:\"documentationFormat,omitempty\""; ParameterInformation struct { LabelOffsetSupport bool "json:\"labelOffsetSupport,omitempty\"" } "json:\"parameterInformation,omitempty\"" } "json:\"signatureInformation,omitempty\"" }{},
            References:         struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" }{},
            DocumentHighlight:  struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" }{},
            DocumentSymbol:     struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; SymbolKind struct { ValueSet []protocol.SymbolKind "json:\"valueSet,omitempty\"" } "json:\"symbolKind,omitempty\""; HierarchicalDocumentSymbolSupport bool "json:\"hierarchicalDocumentSymbolSupport,omitempty\"" }{},
            Formatting:         struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" }{},
            RangeFormatting:    struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" }{},
            OnTypeFormatting:   struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" }{},
            Definition:         struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; LinkSupport bool "json:\"linkSupport,omitempty\"" }{},
            CodeAction:         struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; CodeActionLiteralSupport struct { CodeActionKind struct { ValueSet []protocol.CodeActionKind "json:\"valueSet\"" } "json:\"codeActionKind\"" } "json:\"codeActionLiteralSupport,omitempty\"" }{},
            CodeLens:           struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" }{},
            DocumentLink:       struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" }{},
            Rename:             struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; PrepareSupport bool "json:\"prepareSupport,omitempty\"" }{},
            PublishDiagnostics: struct { RelatedInformation bool "json:\"relatedInformation,omitempty\""; TagSupport bool "json:\"tagSupport,omitempty\"" }{},
            Implementation:     struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; LinkSupport bool "json:\"linkSupport,omitempty\"" }{},
            TypeDefinition:     struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; LinkSupport bool "json:\"linkSupport,omitempty\"" }{},
            ColorProvider:      struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\"" }{},
            FoldingRange:       struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; RangeLimit float64 "json:\"rangeLimit,omitempty\""; LineFoldingOnly bool "json:\"lineFoldingOnly,omitempty\"" }{},
            Declaration:        struct { DynamicRegistration bool "json:\"dynamicRegistration,omitempty\""; LinkSupport bool "json:\"linkSupport,omitempty\"" }{},
        },
        Window:       protocol.WindowClientCapabilities{},
        Experimental: nil,
    },
    InitializationOptions: map[string]interface {}{
        "noDocsOnHover": bool(true),
    },
    Trace:            "",
    WorkspaceFolders: nil,
}
gopls server end =======================
gopls server start =======================
gopls.Initialize() return; err: ; res:
&protocol.InitializeResult{
    Capabilities: protocol.ServerCapabilities{
        TextDocumentSync: map[string]interface {}{
            "change":    float64(1),
            "openClose": bool(true),
        },
        HoverProvider:      true,
        CompletionProvider: &protocol.CompletionOptions{
            TriggerCharacters:   {"."},
            AllCommitCharacters: nil,
            ResolveProvider:     false,
        },
        SignatureHelpProvider: &protocol.SignatureHelpOptions{
            TriggerCharacters: {"(", ","},
        },
        DefinitionProvider:               true,
        ReferencesProvider:               false,
        DocumentHighlightProvider:        true,
        DocumentSymbolProvider:           true,
        WorkspaceSymbolProvider:          false,
        CodeActionProvider:               true,
        CodeLensProvider:                 (*protocol.CodeLensOptions)(nil),
        DocumentFormattingProvider:       true,
        DocumentRangeFormattingProvider:  false,
        DocumentOnTypeFormattingProvider: (*struct { FirstTriggerCharacter string "json:\"firstTriggerCharacter\""; MoreTriggerCharacter []string "json:\"moreTriggerCharacter,omitempty\"" })(nil),
        RenameProvider:                   (*protocol.RenameOptions)(nil),
        DocumentLinkProvider:             &protocol.DocumentLinkOptions{},
        ExecuteCommandProvider:           (*protocol.ExecuteCommandOptions)(nil),
        Experimental:                     nil,
        ImplementationProvider:           false,
        TypeDefinitionProvider:           true,
        Workspace:                        &struct { WorkspaceFolders *struct { Supported bool "json:\"supported,omitempty\""; ChangeNotifications string "json:\"changeNotifications,omitempty\"" } "json:\"workspaceFolders,omitempty\"" }{
            WorkspaceFolders: &struct { Supported bool "json:\"supported,omitempty\""; ChangeNotifications string "json:\"changeNotifications,omitempty\"" }{Supported:true, ChangeNotifications:"workspace/didChangeWorkspaceFolders"},
        },
        ColorProvider:        false,
        FoldingRangeProvider: false,
        DeclarationProvider:  false,
    },
    Custom: {},
}
gopls server end =======================
gopls server start =======================
gopls.Initialized() call; params:
&protocol.InitializedParams{}
gopls server end =======================
gopls server start =======================
gopls.Initialized() return; err: 
gopls server end =======================
gopls client start =======================
RegisterCapability: &protocol.RegistrationParams{
    Registrations: {
        {
            ID:              "workspace/didChangeConfiguration",
            Method:          "workspace/didChangeConfiguration",
            RegisterOptions: nil,
        },
        {
            ID:              "workspace/didChangeWorkspaceFolders",
            Method:          "workspace/didChangeWorkspaceFolders",
            RegisterOptions: nil,
        },
    },
}
gopls client end =======================
gopls client start =======================
Configuration: &protocol.ConfigurationParams{
    Items: {
        {ScopeURI:"file:///tmp/go-test-script020120554/script-complete_watched", Section:"gopls"},
    },
}
gopls client end =======================
gopls server start =======================
gopls.DidOpen() call; params:
&protocol.DidOpenTextDocumentParams{
    TextDocument: protocol.TextDocumentItem{URI:"file:///tmp/go-test-script020120554/script-complete_watched/main.go", LanguageID:"", Version:0, Text:"package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println()\n}\n"},
}
gopls server end =======================
gopls server start =======================
gopls.DidOpen() return; err: 
gopls server end =======================
gopls client start =======================
LogMessage callback: &protocol.LogMessageParams{Type:3, Message:"#### Build info\n\ngolang.org/x/tools/cmd/gopls\n    golang.org/x/tools@v0.0.0-20190530215528-75312fb06703 h1:hWZbwSZGNRstOAFCxoof73JLIo3O4N6UiBNKX73eJ8Q=\n    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=\n\n\n#### Go info\n\ngo version devel +385b2e0cac Fri May 24 21:34:53 2019 +0000 linux/amd64\n\nGO111MODULE=\"on\"\nGOARCH=\"amd64\"\nGOBIN=\"/home/myitcv/gostuff/src/github.com/myitcv/govim/cmd/govim/.bin\"\nGOCACHE=\"/home/myitcv/.cache/go-build\"\nGOENV=\"/home/myitcv/.config/go/env\"\nGOEXE=\"\"\nGOFLAGS=\"\"\nGOHOSTARCH=\"amd64\"\nGOHOSTOS=\"linux\"\nGONOPROXY=\"\"\nGONOSUMDB=\"\"\nGOOS=\"linux\"\nGOPATH=\"/home/myitcv/gostuff\"\nGOPROXY=\"https://proxy.golang.org/\"\nGOROOT=\"/home/myitcv/gos\"\nGOSUMDB=\"sum.golang.org\"\nGOTMPDIR=\"\"\nGOTOOLDIR=\"/home/myitcv/gos/pkg/tool/linux_amd64\"\nGCCGO=\"gccgo\"\nAR=\"ar\"\nCC=\"gcc\"\nCXX=\"g++\"\nCGO_ENABLED=\"1\"\nGOMOD=\"/home/myitcv/gostuff/src/github.com/myitcv/govim/go.mod\"\nCGO_CFLAGS=\"-g -O2\"\nCGO_CPPFLAGS=\"\"\nCGO_CXXFLAGS=\"-g -O2\"\nCGO_FFLAGS=\"-g -O2\"\nCGO_LDFLAGS=\"-g -O2\"\nPKG_CONFIG=\"pkg-config\"\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build209897307=/tmp/go-build -gno-record-gcc-switches\"\n"}
gopls client end =======================
gopls client start =======================
PublishDiagnostics callback: &protocol.PublishDiagnosticsParams{
    URI:         "file:///tmp/go-test-script020120554/script-complete_watched/main.go",
    Version:     0,
    Diagnostics: {
    },
}
gopls client end =======================
gopls server start =======================
gopls.DidOpen() call; params:
&protocol.DidOpenTextDocumentParams{
    TextDocument: protocol.TextDocumentItem{URI:"file:///tmp/go-test-script020120554/script-complete_watched/const.go", LanguageID:"", Version:0, Text:"package main\n\nconst (\n\tConst1 = 1\n\tConst2 = 2\n)\n"},
}
gopls server end =======================
gopls server start =======================
gopls.DidOpen() return; err: 
gopls server end =======================
gopls server start =======================
gopls.DidChange() call; params:
&protocol.DidChangeTextDocumentParams{
    TextDocument: protocol.VersionedTextDocumentIdentifier{
        Version:                1,
        TextDocumentIdentifier: protocol.TextDocumentIdentifier{URI:"file:///tmp/go-test-script020120554/script-complete_watched/const.go"},
    },
    ContentChanges: {
        {
            Range:       (*protocol.Range)(nil),
            RangeLength: 0,
            Text:        "package main\n\nconst (\n\tConst1 = 1\n\tConst2 = 2\n)\n",
        },
    },
}
gopls server end =======================
gopls server start =======================
gopls.DidChange() return; err: 
gopls server end =======================
gopls client start =======================
LogMessage callback: &protocol.LogMessageParams{Type:1, Message:"unable to check package for file:///tmp/go-test-script020120554/script-complete_watched/const.go: parse: no package found for /tmp/go-test-script020120554/script-complete_watched/const.go"}
gopls client end =======================
gopls client start =======================
LogMessage callback: &protocol.LogMessageParams{Type:1, Message:"unable to check package for file:///tmp/go-test-script020120554/script-complete_watched/const.go: parse: no package found for /tmp/go-test-script020120554/script-complete_watched/const.go"}
gopls client end =======================
gopls client start =======================
PublishDiagnostics callback: &protocol.PublishDiagnosticsParams{
    URI:         "file:///tmp/go-test-script020120554/script-complete_watched/const.go",
    Version:     0,
    Diagnostics: {
        {
            Range:              protocol.Range{},
            Severity:           1,
            Code:               nil,
            Source:             "LSP",
            Message:            "file:///tmp/go-test-script020120554/script-complete_watched/const.go is not part of a package",
            Tags:               nil,
            RelatedInformation: nil,
        },
    },
}
gopls client end =======================
gopls client start =======================
LogMessage callback: &protocol.LogMessageParams{Type:1, Message:"unable to check package for file:///tmp/go-test-script020120554/script-complete_watched/const.go: parse: no package found for /tmp/go-test-script020120554/script-complete_watched/const.go"}
gopls client end =======================
gopls client start =======================
LogMessage callback: &protocol.LogMessageParams{Type:1, Message:"unable to check package for file:///tmp/go-test-script020120554/script-complete_watched/const.go: parse: no package found for /tmp/go-test-script020120554/script-complete_watched/const.go"}
gopls client end =======================
gopls client start =======================
PublishDiagnostics callback: &protocol.PublishDiagnosticsParams{
    URI:         "file:///tmp/go-test-script020120554/script-complete_watched/const.go",
    Version:     0,
    Diagnostics: {
        {
            Range:              protocol.Range{},
            Severity:           1,
            Code:               nil,
            Source:             "LSP",
            Message:            "file:///tmp/go-test-script020120554/script-complete_watched/const.go is not part of a package",
            Tags:               nil,
            RelatedInformation: nil,
        },
    },
}
gopls client end =======================
gopls server start =======================
gopls.Completion() call; params:
&protocol.CompletionParams{
    Context:                    (*protocol.CompletionContext)(nil),
    TextDocumentPositionParams: protocol.TextDocumentPositionParams{
        TextDocument: protocol.TextDocumentIdentifier{URI:"file:///tmp/go-test-script020120554/script-complete_watched/main.go"},
        Position:     protocol.Position{Line:5, Character:13},
    },
}
gopls server end =======================
gopls server start =======================
gopls.Completion() return; err: ; res:
&protocol.CompletionList{
    IsIncomplete: false,
    Items:        {
        {
            Label:            "fmt",
            Kind:             9,
            Detail:           "\"fmt\"",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        true,
            SortText:         "00000",
            FilterText:       "fmt",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "fmt",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "main()",
            Kind:             3,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00001",
            FilterText:       "main",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "main",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "append(slice []Type, elems ...Type)",
            Kind:             3,
            Detail:           "[]Type",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00002",
            FilterText:       "append",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "append",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "bool",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00003",
            FilterText:       "bool",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "bool",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "byte",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00004",
            FilterText:       "byte",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "byte",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "cap(v Type)",
            Kind:             3,
            Detail:           "int",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00005",
            FilterText:       "cap",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "cap",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "close(c chan<- Type)",
            Kind:             3,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00006",
            FilterText:       "close",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "close",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "complex(r float64, i float64)",
            Kind:             3,
            Detail:           "complex128",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00007",
            FilterText:       "complex",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "complex",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "complex128",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00008",
            FilterText:       "complex128",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "complex128",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "complex64",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00009",
            FilterText:       "complex64",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "complex64",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "copy(dst []Type, src []Type)",
            Kind:             3,
            Detail:           "int",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00010",
            FilterText:       "copy",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "copy",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "delete(m map[Type]Type1, key Type)",
            Kind:             3,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00011",
            FilterText:       "delete",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "delete",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "error",
            Kind:             8,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00012",
            FilterText:       "error",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "error",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "false",
            Kind:             21,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00013",
            FilterText:       "false",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "false",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "float32",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00014",
            FilterText:       "float32",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "float32",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "float64",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00015",
            FilterText:       "float64",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "float64",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "imag(c complex128)",
            Kind:             3,
            Detail:           "float64",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00016",
            FilterText:       "imag",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "imag",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "int",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00017",
            FilterText:       "int",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "int",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "int16",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00018",
            FilterText:       "int16",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "int16",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "int32",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00019",
            FilterText:       "int32",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "int32",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "int64",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00020",
            FilterText:       "int64",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "int64",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "int8",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00021",
            FilterText:       "int8",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "int8",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "iota",
            Kind:             21,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00022",
            FilterText:       "iota",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "iota",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "len(v Type)",
            Kind:             3,
            Detail:           "int",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00023",
            FilterText:       "len",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "len",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "make(t Type, size ...int)",
            Kind:             3,
            Detail:           "Type",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00024",
            FilterText:       "make",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "make",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "new(Type)",
            Kind:             3,
            Detail:           "*Type",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00025",
            FilterText:       "new",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "new",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "nil",
            Kind:             6,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00026",
            FilterText:       "nil",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "nil",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "panic(v interface{})",
            Kind:             3,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00027",
            FilterText:       "panic",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "panic",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "print(args ...Type)",
            Kind:             3,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00028",
            FilterText:       "print",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "print",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "println(args ...Type)",
            Kind:             3,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00029",
            FilterText:       "println",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "println",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "real(c complex128)",
            Kind:             3,
            Detail:           "float64",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00030",
            FilterText:       "real",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "real",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "recover()",
            Kind:             3,
            Detail:           "interface{}",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00031",
            FilterText:       "recover",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "recover",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             &protocol.Command{
                Title:     "",
                Command:   "editor.action.triggerParameterHints",
                Arguments: nil,
            },
            Data: nil,
        },
        {
            Label:            "rune",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00032",
            FilterText:       "rune",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "rune",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "string",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00033",
            FilterText:       "string",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "string",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "true",
            Kind:             21,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00034",
            FilterText:       "true",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "true",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "uint",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00035",
            FilterText:       "uint",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "uint",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "uint16",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00036",
            FilterText:       "uint16",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "uint16",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "uint32",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00037",
            FilterText:       "uint32",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "uint32",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "uint64",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00038",
            FilterText:       "uint64",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "uint64",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "uint8",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00039",
            FilterText:       "uint8",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "uint8",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
        {
            Label:            "uintptr",
            Kind:             25,
            Detail:           "",
            Documentation:    "",
            Deprecated:       false,
            Preselect:        false,
            SortText:         "00040",
            FilterText:       "uintptr",
            InsertText:       "",
            InsertTextFormat: 1,
            TextEdit:         &protocol.TextEdit{
                Range: protocol.Range{
                    Start: protocol.Position{Line:5, Character:13},
                    End:   protocol.Position{Line:5, Character:13},
                },
                NewText: "uintptr",
            },
            AdditionalTextEdits: nil,
            CommitCharacters:    nil,
            Command:             (*protocol.Command)(nil),
            Data:                nil,
        },
    },
}
gopls server end =======================
gopls server start =======================
gopls.CodeAction() call; params:
&protocol.CodeActionParams{
    TextDocument: protocol.TextDocumentIdentifier{URI:"file:///tmp/go-test-script020120554/script-complete_watched/main.go"},
    Range:        protocol.Range{},
    Context:      protocol.CodeActionContext{},
}
gopls server end =======================
gopls server start =======================
gopls.CodeAction() return; err: ; res:
[]protocol.CodeAction(nil)
gopls server end =======================
gopls server start =======================
gopls.Shutdown() call
gopls server end =======================
gopls server start =======================
gopls.Shutdown() return; err: 
gopls server end =======================

This worked consistently prior to https://go-review.googlesource.com/c/tools/+/178724 and fails consistently after it.

What did you expect to see?

A passing test.

What did you see instead?

The parse error above, and hence a failing test (because the completion fails).


cc @stamblerre @ianthehat

@gopherbot gopherbot added this to the Unreleased milestone May 31, 2019
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented May 31, 2019

Is this only for this specific file, or is it the case for other files too?

@myitcv
Copy link
Member Author

@myitcv myitcv commented May 31, 2019

This is the only test that fails... but that doesn't preclude there being other situations. I just found this test failure on trying to upgrade to the latest tools so reported.

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented May 31, 2019

Ok, thanks. Just to confirm, you're certain it's specifically that CL that caused it to break? I'm just surprised because that CL fixed an issue with dependencies, and your test code doesn't have any dependencies.

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented May 31, 2019

Oh, my mistake, I see that you do. Will investigate further.

@tonyghita
Copy link

@tonyghita tonyghita commented Jun 5, 2019

I can reproduce this when introducing a new test file.

  • create a new file foo_test.go in an existing package bar
  • initialize the file with one line package bar_test
  • get this error message
[Error - 1:44:47 PM] unable to check package for file:///Users/tonyghita/go/src/github.com/my/project/bar/foo_test.go: parse: no package found for /Users/tonyghita/go/src/github.com/my/project/bar/foo_test.go
[Error - 1:44:47 PM] Request textDocument/codeAction failed.
  Message: line is beyond end of file
  Code: 0 
@k1ng440
Copy link

@k1ng440 k1ng440 commented Jun 6, 2019

[Error - 02:24:09] Request textDocument/hover failed.
  Message: no identifier found
  Code: 0 
[Info  - 02:24:15] no completions found for file:///e/coinread/coinread-api/controllers/base-controller/controller.go:14:2: this is a definition, of package . ("github.com/coinread/log")
[Error - 02:25:41] Request textDocument/codeAction failed.
  Message: /e/coinread/coinread-api/controllers/base-controller/controller.go:15:2: string literal not terminated
  Code: 0 
[Error - 02:25:44] unable to check package for file:///e/coinread/coinread-api/controllers/base-controller/controller_test.go: parse: no package found for /e/coinread/coinread-api/controllers/base-controller/controller_test.go
[Error - 02:25:44] unable to check package for file:///e/coinread/coinread-api/controllers/base-controller/controller.go: parse: no package found for /e/coinread/coinread-api/controllers/base-controller/controller.go
[Error - 02:25:44] unable to check package for file:///e/coinread/coinread-api/controllers/base-controller/controller.go: parse: no package found for /e/coinread/coinread-api/controllers/base-controller/controller.go
[Error - 02:25:44] unable to check package for file:///e/coinread/coinread-api/controllers/base-controller/controller.go: parse: no package found for /e/coinread/coinread-api/controllers/base-controller/controller.go
[Error - 02:25:44] Request textDocument/codeAction failed.
  Message: no file information for file:///e/coinread/coinread-api/controllers/base-controller/controller.go
  Code: 0 
[Error - 02:25:44] unable to check package for file:///e/coinread/coinread-api/controllers/base-controller/controller.go: parse: no package found for /e/coinread/coinread-api/controllers/base-controller/controller.go
[Error - 02:25:44] unable to check package for file:///e/coinread/coinread-api/controllers/base-controller/controller.go: parse: no package found for /e/coinread/coinread-api/controllers/base-controller/controller.go
[Error - 02:25:44] unable to check package for file:///e/coinread/coinread-api/controllers/base-controller/controller.go: parse: no package found for /e/coinread/coinread-api/controllers/base-controller/controller.go
[Error - 02:25:44] unable to check package for file:///e/coinread/coinread-api/controllers/base-controller/controller.go: parse: no package found for /e/coinread/coinread-api/controllers/base-controller/controller.go
[Error - 02:25:44] unable to check package for file:///e/coinread/coinread-api/controllers/base-controller/controller.go: parse: no package found for /e/coinread/coinread-api/controllers/base-controller/controller.go
[Error - 02:25:44] unable to check package for file:///e/coinread/coinread-api/controllers/base-controller/controller.go: parse: no package found for /e/coinread/coinread-api/controllers/base-controller/controller.go
[Error - 02:25:44] unable to check package for file:///e/coinread/coinread-api/controllers/base-controller/controller.go: parse: no package found for /e/coinread/coinread-api/controllers/base-controller/controller.go
[Error - 02:25:44] Request textDocument/codeAction failed.
  Message: no token file for file:///e/coinread/coinread-api/controllers/base-controller/controller.go
  Code: 0 
@hugoamvieira
Copy link

@hugoamvieira hugoamvieira commented Jun 7, 2019

Having the same problem. In my situation pretty much all functionality stops working. No Cmd+LClick (Go to definition) on VS Code, no hover, nothing. I get the following errors:

For hover:

[Error - 5:44:15 PM] unable to check package for <path_to_go_file.go> parse: no package found for <path_to_go_file.go>
[Error - 5:44:15 PM] Request textDocument/hover failed.
Message: no AST for <path_to_go_file.go> 
Code: 0 

For Cmd + LClick:

[Error - 5:46:41 PM] unable to check package for <path_to_go_file.go>: parse: no package found for <path_to_go_file.go>
[Error - 5:46:41 PM] Request textDocument/codeAction failed.
  Message: no file information for <path_to_go_file.go>
  Code: 0 

Since I redacted my files' names, some relevant info about them:

  • I am working inside $GOPATH
  • It's a repository that holds many backend micro-services.
  • Follows pretty normal structure of github.com/<company_name>/<repository_name>/<service_name>/<package>/file.go
  • The error always specifies an actual .go file

Also important to mention that this seems to be intermittent and comes and goes (though I usually reload the window to get rid of this)

Hopefully this helps!

PS : I also sometimes get these (in this case, it's the strings.ContainsAny() function), it gets underlined in red:

[Error - 5:54:56 PM] Request textDocument/hover failed.
  Message: no object for ident ContainsAny
  Code: 0 

I confirmed that the strings package is imported.

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 7, 2019

Change https://golang.org/cl/181317 mentions this issue: internal/lsp: improve error handling while parsing

@myitcv
Copy link
Member Author

@myitcv myitcv commented Jun 9, 2019

This looks very related/the same to #32341?

cc @muirrn for thoughts?

@muirdm
Copy link

@muirdm muirdm commented Jun 9, 2019

Yes they are probably the same issue. I didn't mark them "fixed" in my cl because there is another bug #30100 that can cause similar behavior in tests only (the bug description doesn't really indicate it, but it can cause test files to get stuck with the "no package for file" error).

@hexdigest
Copy link

@hexdigest hexdigest commented Jun 10, 2019

Same issue here.

I use gopls with neoclide/coc.nvim with gopls running in server mode:
gopls serve -listen 127.0.0.1:8282 -rpc.trace

When I try to go to definition I have following lines in console:

[Trace - 12:56:44 PM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"unable to check package for file:///home/max/src/github.com/gojuno/goasync/cmd/goasync/goasync.go: /home/max/src/github.com/gojuno/goasync/cmd/goasync/goasync.go: no packages found"}


[Error - 12:56:44 PM] send textDocument/definition#4 no AST for file:///home/max/src/github.com/gojuno/goasync/cmd/goasync/goasync.go
gopherbot pushed a commit to golang/tools that referenced this issue Jun 11, 2019
If the context is canceled (or times out) during parsing, we were
previously caching the package with no *ast.Files. Any further LSP
queries against that package would fail because the package is already
loaded, but none of the files are mapped to the package. Fix by
propagating non-parse errors as "fatal" errors in
parseFiles. typeCheck will propagate these errors and not cache the
package.

I also fixed the package cache to not cache errors loading
packages. If you get an error like "context canceled" then none of the
package's files are mapped to the package. This prevents the package
from ever getting unmapped when its files are updated. I also added a
retry mechanism where if the current request is not canceled but the
package failed to load due to a previous request being canceled, this
request can try loading the package again.

Updates golang/go#32354, golang/go#32360

Change-Id: I466ddb8d336aeecf6e50f9f6d040787a86a60ca0
GitHub-Last-Rev: 5f1e7ef
GitHub-Pull-Request: #110
Reviewed-on: https://go-review.googlesource.com/c/tools/+/181317
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@muirdm
Copy link

@muirdm muirdm commented Jun 12, 2019

Are people still seeing this error on master? Some fixes got merged today that should help.

@myitcv
Copy link
Member Author

@myitcv myitcv commented Jun 12, 2019

Thanks @muirrn, this was indeed addressed by one of those many CLs!

@myitcv myitcv closed this Jun 12, 2019
@tonyghita
Copy link

@tonyghita tonyghita commented Jun 12, 2019

Same, can confirm the fix. Thank you!

@hugoamvieira
Copy link

@hugoamvieira hugoamvieira commented Jun 13, 2019

Confirm here too. Thank you all :)

@LordNoteworthy
Copy link

@LordNoteworthy LordNoteworthy commented Aug 25, 2019

Confirm the issue as well. Running the latest version of gopls.

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Aug 26, 2019

@LordNoteworthy: Are you seeing this issue, or confirming the fix? If you are seeing an issue, please file a new bug here.

@golang golang locked and limited conversation to collaborators Aug 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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