You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
I am working on the integration of a editor and go language server. In rare cases, I can see error "Header must provide a Content-Length property" and then go language server shut down.
I saw in the output of go language server, its response is malformed like below, which causes the client side cannot parse the response correctly.
The error above is from gocode and the "invalid memory address or nil pointer dereference" it refers to is in function fixup_packages. In the first if statement, pcache[path] is nil, but it tries to access its defalias.
func fixup_packages(filescope *scope, pkgs []package_import, pcache package_cache) {
for _, p := range pkgs {
path, alias := p.abspath, p.alias
if alias == "" {
alias = pcache[path].defalias
}
// skip packages that will be merged to the package scope
if alias == "." {
continue
}
filescope.replace_decl(alias, pcache[path].main)
}
}
It is not easy for me to reproduce this problem which makes debugging difficult. If you have more knowledge of gocode and go language server, could you please let me know if my guess is correct.
The text was updated successfully, but these errors were encountered:
Nice catch with both the upstream issue in gocode and it printing to stderr. We actually need to switch to https://github.com/mdempsky/gocode anyways. We probably need to work out a way to more cleanly integrate gocode as it is. Right now it is manually vendored in and modified, and as such it makes it harder to integrate upstream changes.
Thanks for the reply. I think the gocode writes errors directly into stdout instead of stderr, it uses fmt.Printf to write errors and the response write to stdout also. I would like to know if you have a ETA for the integration of new gocode? Thanks!
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am working on the integration of a editor and go language server. In rare cases, I can see error "Header must provide a Content-Length property" and then go language server shut down.
I saw in the output of go language server, its response is malformed like below, which causes the client side cannot parse the response correctly.
The error above is from gocode and the "invalid memory address or nil pointer dereference" it refers to is in function fixup_packages. In the first if statement, pcache[path] is nil, but it tries to access its defalias.
One thing I found is in gocode, if something gets wrong, sometimes print_backtrace(err) is called to write panic and related information to standard output, which may pollutes the response.
Related file: https://github.com/nsf/gocode/blob/416643789f088aa5077f667cecde7f966131f6be/autocompletecontext.go
https://github.com/nsf/gocode/blob/d09cef6327ed848a446636a857cd851dc7e63d19/utils.go#L184
It is not easy for me to reproduce this problem which makes debugging difficult. If you have more knowledge of gocode and go language server, could you please let me know if my guess is correct.
The text was updated successfully, but these errors were encountered: