Skip to content

proposal: embed: give error in 1.14.x and 1.15.x if a go:embed directive is seen #43558

@ianlancetaylor

Description

@ianlancetaylor

This is an idea from @marwan-at-work described at #43217 (comment).

We seem likely to accept proposal #43217 which will permit writing code like

//go:embed data.txt
var data string

In particular this file will not need to import the "embed" package. It follows that this code will compile without errors when using a release of Go from before 1.16, but the code will not work as expected.

To reduce the possibility of problems during this transition, this proposal is that for the next Go 1.14.x and 1.15.x releases, any line comment at package scope that starts with //go:embed should be treated as a compilation error.

CC @Merovius @rsc @robpike

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions