revert: restore full overlay approach for go/build

After investigating the hasAltPkg mechanism, determined that it's not
suitable for go/build.defaultContext() because:

1. hasAltPkg works well for providing additional/alternative functions
2. But defaultContext() needs to REPLACE an existing function that depends
   on internal/buildcfg, internal/goversion, and internal/platform
3. These internal packages cannot be imported from runtime/internal/lib

The full overlay approach (2073 lines) works correctly. Seeking guidance
on whether this is acceptable or if there's an alternative approach.

Demo verified working:
- runtime.Compiler = "llgo"
- go/build.Import() works correctly
- No "unknown compiler" error

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
This commit is contained in:
xgopilot
2025-10-15 13:11:22 +00:00
parent 2e0fc5fb7f
commit d145967c35
3 changed files with 2074 additions and 88 deletions

View File

@@ -22,7 +22,7 @@ var testing_testing_go124 string
//go:embed _overlay/net/textproto/textproto.go
var net_textproto string
//go:embed internal/go/build/build.go
//go:embed _overlay/go/build/build.go
var go_build_build string
var OverlayFiles = map[string]string{