patch: fmt, os, runtime, syscall, time

This commit is contained in:
xushiwei
2024-06-26 17:17:10 +08:00
parent fd0cb4c458
commit 48a1384197
30 changed files with 5373 additions and 24 deletions

View File

@@ -20,3 +20,17 @@ package runtime
import (
_ "unsafe"
)
// GOROOT returns the root of the Go tree. It uses the
// GOROOT environment variable, if set at process start,
// or else the root used during the Go build.
func GOROOT() string {
/*
s := gogetenv("GOROOT")
if s != "" {
return s
}
return defaultGOROOT
*/
panic("todo: GOROOT")
}

View File

@@ -0,0 +1,30 @@
//go:build 386
package runtime
const GOARCH = `386`
const Is386 = 1
const IsAmd64 = 0
const IsAmd64p32 = 0
const IsArm = 0
const IsArmbe = 0
const IsArm64 = 0
const IsArm64be = 0
const IsLoong64 = 0
const IsMips = 0
const IsMipsle = 0
const IsMips64 = 0
const IsMips64le = 0
const IsMips64p32 = 0
const IsMips64p32le = 0
const IsPpc = 0
const IsPpc64 = 0
const IsPpc64le = 0
const IsRiscv = 0
const IsRiscv64 = 0
const IsS390 = 0
const IsS390x = 0
const IsSparc = 0
const IsSparc64 = 0
const IsWasm = 0

View File

@@ -0,0 +1,30 @@
//go:build amd64
package runtime
const GOARCH = `amd64`
const Is386 = 0
const IsAmd64 = 1
const IsAmd64p32 = 0
const IsArm = 0
const IsArmbe = 0
const IsArm64 = 0
const IsArm64be = 0
const IsLoong64 = 0
const IsMips = 0
const IsMipsle = 0
const IsMips64 = 0
const IsMips64le = 0
const IsMips64p32 = 0
const IsMips64p32le = 0
const IsPpc = 0
const IsPpc64 = 0
const IsPpc64le = 0
const IsRiscv = 0
const IsRiscv64 = 0
const IsS390 = 0
const IsS390x = 0
const IsSparc = 0
const IsSparc64 = 0
const IsWasm = 0

View File

@@ -0,0 +1,30 @@
//go:build arm64
package runtime
const GOARCH = `arm64`
const Is386 = 0
const IsAmd64 = 0
const IsAmd64p32 = 0
const IsArm = 0
const IsArmbe = 0
const IsArm64 = 1
const IsArm64be = 0
const IsLoong64 = 0
const IsMips = 0
const IsMipsle = 0
const IsMips64 = 0
const IsMips64le = 0
const IsMips64p32 = 0
const IsMips64p32le = 0
const IsPpc = 0
const IsPpc64 = 0
const IsPpc64le = 0
const IsRiscv = 0
const IsRiscv64 = 0
const IsS390 = 0
const IsS390x = 0
const IsSparc = 0
const IsSparc64 = 0
const IsWasm = 0

View File

@@ -0,0 +1,30 @@
//go:build wasm
package runtime
const GOARCH = `wasm`
const Is386 = 0
const IsAmd64 = 0
const IsAmd64p32 = 0
const IsArm = 0
const IsArmbe = 0
const IsArm64 = 0
const IsArm64be = 0
const IsLoong64 = 0
const IsMips = 0
const IsMipsle = 0
const IsMips64 = 0
const IsMips64le = 0
const IsMips64p32 = 0
const IsMips64p32le = 0
const IsPpc = 0
const IsPpc64 = 0
const IsPpc64le = 0
const IsRiscv = 0
const IsRiscv64 = 0
const IsS390 = 0
const IsS390x = 0
const IsSparc = 0
const IsSparc64 = 0
const IsWasm = 1

View File

@@ -0,0 +1,24 @@
//go:build android
package runtime
const GOOS = `android`
const IsAix = 0
const IsAndroid = 1
const IsDarwin = 0
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 0
const IsIllumos = 0
const IsIos = 0
const IsJs = 0
const IsLinux = 0
const IsNacl = 0
const IsNetbsd = 0
const IsOpenbsd = 0
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,24 @@
//go:build !ios && darwin
package runtime
const GOOS = `darwin`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 1
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 0
const IsIllumos = 0
const IsIos = 0
const IsJs = 0
const IsLinux = 0
const IsNacl = 0
const IsNetbsd = 0
const IsOpenbsd = 0
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,24 @@
//go:build ios
package runtime
const GOOS = `ios`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 0
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 0
const IsIllumos = 0
const IsIos = 1
const IsJs = 0
const IsLinux = 0
const IsNacl = 0
const IsNetbsd = 0
const IsOpenbsd = 0
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,24 @@
//go:build js
package runtime
const GOOS = `js`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 0
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 0
const IsIllumos = 0
const IsIos = 0
const IsJs = 1
const IsLinux = 0
const IsNacl = 0
const IsNetbsd = 0
const IsOpenbsd = 0
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,24 @@
//go:build !android && linux
package runtime
const GOOS = `linux`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 0
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 0
const IsIllumos = 0
const IsIos = 0
const IsJs = 0
const IsLinux = 1
const IsNacl = 0
const IsNetbsd = 0
const IsOpenbsd = 0
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,24 @@
//go:build windows
package runtime
const GOOS = `windows`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 0
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 0
const IsIllumos = 0
const IsIos = 0
const IsJs = 0
const IsLinux = 0
const IsNacl = 0
const IsNetbsd = 0
const IsOpenbsd = 0
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 1
const IsZos = 0