-
Notifications
You must be signed in to change notification settings - Fork 656
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
struct problems by new binary format #352
Comments
Ok, I'll take a look at these cases, maybe some time during the week, maybe on the weekend. Thanks for reporting. |
@nsf Thanks. I'm Go beginner, but maybe I'm not busy than your schedule. |
FYI, with github.com/mdempsky/gocode, the suggestions I get for
(This could perhaps be improved by recognizing that in a function signature context, only types are applicable.) And for
For your second using github.com/derekparker/delve/service/rpc2, I get:
|
@mdempsky Thanks for the comment, and I tried it.
Is it meaning of |
@zchee Cool, glad to hear it works for you. As for gb support, I essentially mean how to map import paths to .a files. That's unrelated to this issue though, so feel free to follow/comment on mdempsky#1 if you'd like. |
First issue is very simple. diff --git a/decl.go b/decl.go
index 86c0c29..ad1a42b 100644
--- a/decl.go
+++ b/decl.go
@@ -330,7 +330,10 @@ func method_of(d ast.Decl) string {
if se, ok := t.X.(*ast.SelectorExpr); ok {
return se.Sel.Name
}
- return t.X.(*ast.Ident).Name
+ if ident, ok := t.X.(*ast.Ident); ok {
+ return ident.Name
+ }
+ return ""
case *ast.Ident:
return t.Name
default: |
Second one, I'm not sure, but maybe it's related with importing "C". |
Sorry, It's not related to "C". package main
import (
"github.com/derekparker/delve/service/api"
"github.com/derekparker/delve/service/rpc2"
)
const addr = "localhost:41222" // d:4 l:12 v:22
func pointerStruct() {
client := rpc2.NewClient(addr)
var bp *api.Breakpoint
bp, _ = client.GetBreakpoint(-1)
bp.
} So I guess several imports are not recognized. |
@mattn Thanks for workaround! As you said, it does not seem to be able to get the type of external(not imported) package. |
Yes, It's a bug. |
Fixed first panic as suggested by @mattn, thanks for a fix. Will take a look at the second one. |
Second case works on gocode which uses textual packages (Go 1.6). If it's indeed fails on Go 1.7 packages, it is a valid regression. I think I know where to look at it, but I will do so when Go 1.7 release is closer. |
Ok, sure. I know where the bug comes from, it just requires a one dedicated day to spend on it, because honestly I have no idea why it happens. But I know where to look. Maybe next weekend I'll spend some time on it, maybe some time later closer to Go 1.7 release. Right now my suggestion: don't use Go 1.7, use Go 1.6 if you can. |
@nsf Sorry, I was closed this :( BTW, As I have mentioned, I'm gopher beginner. I want to do something in return. fast and dynamically, gocode is a good package reference than godoc. |
I found two bugs.
First, It's simple. maybe it's not related new binary format.
If type any character after pointer (e.g.
func (t *T
), gocode occurPANIC
.But if that situation, works fine.
func (t T
func (t *TestStruct) Test(name string) error
function blockfunc (t *
to end of file152
byte offset3 is this situation.
gist: https://gist.github.com/zchee/0789790800f77ad9fa2d06783bc31de2#file-struct-go
byte offset:
151
(include any charactor e.g.T
)cmd:
gocode --in ./struct.go autocomplete 151
Next is an edge case(?). It's related new binary format.
I tried #305 (comment) workaround. works fine.
Sorry, I tried several code, but I could not find another case.
If I found other case, will comment.
This sample is simple code for remote connection to
delve
headless server.gist: https://gist.github.com/zchee/0789790800f77ad9fa2d06783bc31de2#file-delve-go
byte offset:
210
cmd:
gocode --in ./delve.go autocomplete 210
Does not return any complete word after
bp.
.Expected behavior is return that struct values.
https://github.com/derekparker/delve/blob/master/service/api/types.go#L35-L69
but actual behavior is
Nothing to complete.
.Please comment if you need other information.
Thanks.
The text was updated successfully, but these errors were encountered: