build: prototype source patches for stdlib compat#1758
build: prototype source patches for stdlib compat#1758cpunion wants to merge 26 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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1758 +/- ##
==========================================
- Coverage 88.44% 88.44% -0.01%
==========================================
Files 50 50
Lines 13656 13672 +16
==========================================
+ Hits 12078 12092 +14
- Misses 1369 1370 +1
- Partials 209 210 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
552effe to
bd685f8
Compare
7424944 to
0c32ad4
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