import package when required by type of simple declaration

Issue #10 resolved
David Tolpin
repo owner created an issue

A type of new variable declared with := may come from an unimported package. Import the package if the name is available. Example:

package pkgname
import "go/ast"

type Model float64

func (m Model) Observe(x []float64) float64 {
    pos := ast.Ident{}.NamePos
    pos = pos
    return 0.
}

"go/token" must be imported to declare pos.

Comments (1)

  1. Log in to comment