object88 / langd

A Language Server Protocol implementation in Go for Go
MIT License
7 stars 0 forks source link

Failing to load package with name different from directory #12

Closed object88 closed 6 years ago

object88 commented 6 years ago

Example:

foo/foo.go

package foo

import "../gobar"

func add1(param1 int) int {
    bar.TotalCalls++
    return param1+1
}

gobar/stats.go

package bar

var TotalCalls = 0

Getting output:

PSC: foo: current state: 0
PSC: foo: current state: 1
 PP: foo: 1: creating package w/ /go/src/foo:foo
 PP: foo: 1: -> gobar
 PP: foo: 1: *** still waiting on gobar ***
PSC: gobar: current state: 0
PSC: gobar: current state: 1
 PP: gobar: 1: creating package w/ /go/src/gobar:bar
 PP: gobar: 1: -> 
 PP: gobar: 1: all imports fulfilled.
 PC: gobar: Checking bar
 PP: foo: 1: *** still waiting on gobar ***
PSC: gobar: current state: 2
PSC: gobar: current state: 3
PSC: gobar: current state: 4
panic:  PP: foo: 1: target package /go/src/gobar:gobar is !ok
object88 commented 6 years ago

Fixed; tested with loader_non_package_dir_imports_test.go.