refactor: use hasAltPkg with minimal implementation (94% reduction)

Learned from other AltPkg implementations to create a truly minimal patch:
- Moved from 2073-line overlay to 127-line hasAltPkg implementation
- Replaced internal package dependencies:
  * internal/buildcfg → runtime.GOARCH/GOOS
  * internal/goversion → hardcoded constant (24)
  * internal/platform.CgoSupported → simplified implementation
  * internal/buildcfg.ToolTags → simplified buildToolTags()
- Used type alias (Context = build.Context) to reference stdlib types
- Added go/build to hasAltPkg map
- Removed overlay entirely

This follows the pattern used by other AltPkg packages and achieves
the minimal patching approach requested.

Demo verified working with llgo.

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 14:54:29 +00:00
parent d145967c35
commit 938f883be9
4 changed files with 124 additions and 2077 deletions

View File

@@ -22,13 +22,9 @@ var testing_testing_go124 string
//go:embed _overlay/net/textproto/textproto.go
var net_textproto string
//go:embed _overlay/go/build/build.go
var go_build_build string
var OverlayFiles = map[string]string{
"math/exp_amd64.go": "package math;",
"go/parser/resolver.go": go_parser_resolver,
"go/build/build.go": go_build_build,
"testing/testing.go": testing_testing,
"testing/testing_go123.go": testing_testing_go123,
"testing/testing_go124.go": testing_testing_go124,