// OverlayContext overlays a build.Context with additional files from // a map. Files in the map take precedence over other files. // // In addition to plain string comparison, two file names are // considered equal if their base names match and their directory // components point at the same directory on the file system. That is, // symbolic links are followed for directories, but not files. // // A common use case for OverlayContext is to allow editors to pass in // a set of unsaved, modified files. // // Currently, only the Context.OpenFile function will respect the // overlay. This may change in the future. func OverlayContext(orig *build.Context, overlay map[string][]byte) *build.Context { … } // ParseOverlayArchive parses an archive containing Go files and their // contents. The result is intended to be used with OverlayContext. // // # Archive format // // The archive consists of a series of files. Each file consists of a // name, a decimal file size and the file contents, separated by // newlines. No newline follows after the file contents. func ParseOverlayArchive(archive io.Reader) (map[string][]byte, error) { … }