Files
llgo/runtime/build.go
xgopilot 938f883be9 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>
2025-10-15 14:54:29 +00:00

64 lines
1.7 KiB
Go

package runtime
func SkipToBuild(pkgPath string) bool {
if _, ok := hasAltPkg[pkgPath]; ok {
return false
}
return pkgPath == "unsafe"
}
func HasAltPkg(path string) (b bool) {
_, b = hasAltPkg[path]
return
}
type none struct{}
var hasAltPkg = map[string]none{
"crypto/hmac": {},
"crypto/md5": {},
"crypto/rand": {},
"crypto/sha1": {},
"crypto/sha256": {},
"crypto/sha512": {},
"crypto/subtle": {},
"go/build": {},
"go/parser": {},
"hash/crc32": {},
"hash/maphash": {},
"internal/abi": {},
"internal/bytealg": {},
"internal/chacha8rand": {},
"internal/cpu": {},
"internal/itoa": {},
"internal/godebug": {},
"internal/oserror": {},
"internal/poll": {},
"internal/reflectlite": {},
"internal/runtime/atomic": {},
"internal/runtime/maps": {},
"internal/runtime/sys": {},
"internal/sync": {},
"internal/syscall/execenv": {},
"internal/syscall/unix": {},
"math": {},
"math/cmplx": {},
"math/rand": {},
"reflect": {},
"sync": {},
"sync/atomic": {},
"syscall": {},
"syscall/js": {},
"time": {},
"os": {},
"os/exec": {},
"os/signal": {},
"runtime": {},
"runtime/debug": {},
"runtime/pprof": {},
"runtime/trace": {},
"runtime/internal/syscall": {},
"io": {},
"io/fs": {},
}