xhd2015/xgo

Proposal: use text files to patch runtime and compiler

Closed this issue · 2 comments

Rational: Currently we use string search and replace to edit various runtime and compiler files, which is cumbersome and may easily impact on old versions when support new versions.
Implementation: we can prepare patched files for runtime and compiler of various golang versions,and just file copy for supported version. For unsupported version, we can fallback to current implementation.

We can call this strategy file replacement.

And even more, we can be precise on what want to replace: it's function bodies of specific functions we want to replace.
So we can take a step further: only replace functions appear in the patch file.

This way, we do not need to repeat the unchanged part in both the source file and the patch file.

This can be called function replacement.

Addressed in #203 (comment)