Skip to content

go/build: allow Import to ignore build constraints #15396

@okdave

Description

@okdave

There's no way at the moment to use Import or ImportDir to select all the files in package ignoring build constraints. There is the Package.IgnoredGoFiles field, but that does not extend to finding the dependencies of the ignored files, and so requires extra parsing steps.

One use case for this is in situations like App Engine: we want to select all the source files for an app, but not exclude source file that would be needed to compile a package in other/future versions of Go. So, we want to select files ignoring any go1.x tags.

/cc @dsymonds @adg

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions