fix(go-build): remove banned runtime from discovery.go (AX-6)
pkg/build/discovery.go used runtime.GOOS and runtime.GOARCH in DiscoverFull(). Introduced local helpers discoverHostOS() and discoverHostArch() that resolve platform via core.Env cascading: - GOOS/GOARCH env (build-time convention) - HOSTTYPE / OSTYPE fallback - safe literal default (linux/amd64) Dropped the runtime import. Pre-existing build gap (golang.org/x/text@v0.36.0 go.sum) is unrelated to this change and reproduces on dev HEAD. Closes tasks.lthn.sh/view.php?id=236 Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
parent
2a2d56b597
commit
bada5b0930
1 changed files with 43 additions and 4 deletions
|
|
@ -1,8 +1,6 @@
|
|||
package build
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"dappco.re/go/build/internal/ax"
|
||||
"dappco.re/go/core"
|
||||
"dappco.re/go/core/io"
|
||||
|
|
@ -389,8 +387,8 @@ func DiscoverFull(fs io.Medium, dir string) (*DiscoveryResult, error) {
|
|||
|
||||
result := &DiscoveryResult{
|
||||
Types: types,
|
||||
OS: runtime.GOOS,
|
||||
Arch: runtime.GOARCH,
|
||||
OS: discoverHostOS(),
|
||||
Arch: discoverHostArch(),
|
||||
Markers: make(map[string]bool),
|
||||
}
|
||||
|
||||
|
|
@ -472,6 +470,47 @@ func DiscoverFull(fs io.Medium, dir string) (*DiscoveryResult, error) {
|
|||
return result, nil
|
||||
}
|
||||
|
||||
func discoverHostOS() string {
|
||||
if goos := core.Env("GOOS"); goos != "" {
|
||||
return goos
|
||||
}
|
||||
|
||||
if hosttype := core.Env("HOSTTYPE"); hosttype != "" {
|
||||
return hosttype
|
||||
}
|
||||
|
||||
if ostype := core.Env("OSTYPE"); ostype != "" {
|
||||
return ostype
|
||||
}
|
||||
|
||||
return "linux"
|
||||
}
|
||||
|
||||
func discoverHostArch() string {
|
||||
if goarch := core.Env("GOARCH"); goarch != "" {
|
||||
return goarch
|
||||
}
|
||||
|
||||
if hosttype := core.Env("HOSTTYPE"); hosttype != "" {
|
||||
switch hosttype {
|
||||
case "x86_64", "amd64":
|
||||
return "amd64"
|
||||
case "x86", "i386", "i686":
|
||||
return "386"
|
||||
case "aarch64", "arm64":
|
||||
return "arm64"
|
||||
case "arm", "armv7l", "armv6l":
|
||||
return "arm"
|
||||
case "riscv64":
|
||||
return "riscv64"
|
||||
}
|
||||
|
||||
return hosttype
|
||||
}
|
||||
|
||||
return "amd64"
|
||||
}
|
||||
|
||||
// SuggestStack returns the action-oriented stack suggestion for the detected
|
||||
// project markers. This keeps discovery compatible with the v3 action naming,
|
||||
// where Wails-backed projects use the "wails2" stack identifier.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue