build: prototype source patches for stdlib compat#1758
build: prototype source patches for stdlib compat#1758cpunion wants to merge 25 commits intogoplus:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a source patching mechanism for the LLGo compiler, allowing for the modification of standard library and other packages during the build process via an overlay. It includes logic to parse specific directives like //llgo:skipall and //llgo:nopatch to manage code overrides and stubs. Feedback includes a suggestion to improve the robustness of receiver type parsing by handling unexpected types with a panic and a recommendation to use more idiomatic Go for a package existence check.
|
Well-structured PR introducing a clean source-patch mechanism as a more maintainable alternative to alt-package replacements. The directive system ( |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1758 +/- ##
==========================================
- Coverage 93.16% 93.09% -0.08%
==========================================
Files 48 48
Lines 13349 13404 +55
==========================================
+ Hits 12437 12478 +41
- Misses 726 739 +13
- Partials 186 187 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
552effe to
bd685f8
Compare
Summary
source patchmechanism as a third stdlib compatibility path alongside existing alt patchesiteris routed through source patch in this PRGOVERSION, and resolve the targetGOROOTfromgo envWhat This PR Includes
runtime/build.gointernal/build//llgo:skipall//llgo:skip ...//linemappings back to the original patch filesgo env GOROOTinstead of the builder binary's compiled-inruntime.GOROOT()Current Scope
iteris the only package switched from alt patch to source patch in this PRsync/atomic,unique,internal/reflectlite,internal/runtime/maps, andinternal/runtime/sysare kept on their existing non-source-patch pathsProposal
Validation
go test ./internal/build -run '^(TestBuildSourcePatchOverlayForIter|TestIterUsesSourcePatchInsteadOfAltPkg|TestSyncAtomicRemainsAltPkg|TestInternalRuntimeMapsRemainsAltPkg|TestInternalRuntimeSysRemainsAltPkg|TestApplySourcePatchForPkg_Directives|TestApplySourcePatchForPkg_MissingStdlibPkg|TestApplySourcePatchForPkg_BuildTaggedPatch|TestApplySourcePatchForPkg_UnreadableStdlibPkg)$' -count=1go test ./cl -run 'TestFromTestlibgo/atomic$|TestRunFromTestlibgo/atomic$' -count=1LLGO_BUILD_CACHE=0 go run ./cmd/llgo test ./test/std/iter ./test/std/slices ./test/std/maps ./test/std/bytes ./test/std/stringsLLGO_BUILD_CACHE=0 go run ./cmd/llgo test ./test/std/sync/atomic