Skip to content

x/tools/go/loader: improve and stabilize API #14120

@alandonovan

Description

@alandonovan

We should simplify and stabilize the go/loader package's API. Before that happens, there are a number of features to add and bugs to fix:

Features:

  1. support ... patterns just like "go build" and "go list" do. (Ideally the logic would be shared. Russ suggested fork/execing "go list", but I don't like this approach: it uses the actual file system instead of the abstraction defined by build.Context.)

  2. Allow packages specified on the command line to use cgo. Currently only imported packages are subject to cgo preprocessing.

  3. Support pkg-config.

API simplifications:

  1. The public fields of loader.Program are sometimes annoying to use. Study existing clients and come up with something more convenient.

  2. Update the go/types tutorial at https://github.com/golang/example/tree/master/gotypes.

Once this is done, we should use go/loader in tools such as golint, govet and stringer.

cc: @griesemer

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions