GoClipse / goclipse

Eclipse IDE for the Go programming language:
http://goclipse.github.io/
Eclipse Public License 1.0
841 stars 286 forks source link

go to declaration not working for struct fields #217

Closed maxandersen closed 8 years ago

maxandersen commented 8 years ago

I have this code:

package main

// PermissionDefinition defines the Permissions available
type PermissionDefinition struct {
    CreateWorkItem string
    ReadWorkItem   string
    UpdateWorkItem string
    DeleteWorkItem string
}

// CRUDWotkItem returns all CRUD permissions for a WorkItem
func (p *PermissionDefinition) CRUDWotkItem() []string {
    return []string{p.CreateWorkItem, p.ReadWorkItem, p.UpdateWorkItem, p.DeleteWorkItem}
}

var (
    // Permissions defines the value of each Permission
    Permissions = PermissionDefinition{
        CreateWorkItem: "create.workitem",
        ReadWorkItem:   "read.workitem",
        UpdateWorkItem: "update.workitem",
        DeleteWorkItem: "delete.workitem",
    }
)

Using F3 on "PermissionDefintion" brings cursor to "type PermissionDefinition" but if I use F3 on "ReadWorkItem" it complains saying there is no definition for it - I would expect it to move to ReadWorkItem in the PermissionDefintion struct.

bruno-medeiros commented 8 years ago

I'm afraid that is not a Goclipse issue but a https://github.com/rogpeppe/godef limitation. You'd have to open a bug there. That said I found that the guru tool is able to resolve that, so I've opened https://github.com/GoClipse/goclipse/issues/218 - but there are a few reasons I'm reluctant to have guru be used for that purpose.