Initial commit: Go 1.23 release state

This commit is contained in:
Vorapol Rinsatitnon
2024-09-21 23:49:08 +10:00
commit 17cd57a668
13231 changed files with 3114330 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build ignore
package main
import (
"bytes"
"fmt"
"log"
"os"
"strings"
)
var gooses []string
func main() {
data, err := os.ReadFile("../../go/build/syslist.go")
if err != nil {
log.Fatal(err)
}
const goosPrefix = `var knownOS = map[string]bool{`
inGOOS := false
for _, line := range strings.Split(string(data), "\n") {
if strings.HasPrefix(line, goosPrefix) {
inGOOS = true
} else if inGOOS && strings.HasPrefix(line, "}") {
break
} else if inGOOS {
goos := strings.Fields(line)[0]
goos = strings.TrimPrefix(goos, `"`)
goos = strings.TrimSuffix(goos, `":`)
gooses = append(gooses, goos)
}
}
for _, target := range gooses {
if target == "nacl" {
continue
}
var tags []string
if target == "linux" {
tags = append(tags, "!android") // must explicitly exclude android for linux
}
if target == "solaris" {
tags = append(tags, "!illumos") // must explicitly exclude illumos for solaris
}
if target == "darwin" {
tags = append(tags, "!ios") // must explicitly exclude ios for darwin
}
tags = append(tags, target) // must explicitly include target for bootstrapping purposes
var buf bytes.Buffer
fmt.Fprintf(&buf, "// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.\n\n")
fmt.Fprintf(&buf, "//go:build %s\n\n", strings.Join(tags, " && "))
fmt.Fprintf(&buf, "package goos\n\n")
fmt.Fprintf(&buf, "const GOOS = `%s`\n\n", target)
for _, goos := range gooses {
value := 0
if goos == target {
value = 1
}
fmt.Fprintf(&buf, "const Is%s = %d\n", strings.Title(goos), value)
}
err := os.WriteFile("zgoos_"+target+".go", buf.Bytes(), 0666)
if err != nil {
log.Fatal(err)
}
}
}

13
src/internal/goos/goos.go Normal file
View File

@@ -0,0 +1,13 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// package goos contains GOOS-specific constants.
package goos
// The next line makes 'go generate' write the zgoos*.go files with
// per-OS information, including constants named Is$GOOS for every
// known GOOS. The constant is 1 on the current system, 0 otherwise;
// multiplying by them is useful for defining GOOS-specific constants.
//
//go:generate go run gengoos.go

View File

@@ -0,0 +1,9 @@
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !unix
package goos
const IsUnix = false

View File

@@ -0,0 +1,9 @@
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix
package goos
const IsUnix = true

View File

@@ -0,0 +1,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build aix
package goos
const GOOS = `aix`
const IsAix = 1
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 = 0
const IsZos = 0

View File

@@ -0,0 +1,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build android
package goos
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,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build !ios && darwin
package goos
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,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build dragonfly
package goos
const GOOS = `dragonfly`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 0
const IsDragonfly = 1
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,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build freebsd
package goos
const GOOS = `freebsd`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 0
const IsDragonfly = 0
const IsFreebsd = 1
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,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build hurd
package goos
const GOOS = `hurd`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 0
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 1
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,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build illumos
package goos
const GOOS = `illumos`
const IsAix = 0
const IsAndroid = 0
const IsDarwin = 0
const IsDragonfly = 0
const IsFreebsd = 0
const IsHurd = 0
const IsIllumos = 1
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,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build ios
package goos
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,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build js
package goos
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,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build !android && linux
package goos
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,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build netbsd
package goos
const GOOS = `netbsd`
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 = 1
const IsOpenbsd = 0
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build openbsd
package goos
const GOOS = `openbsd`
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 = 1
const IsPlan9 = 0
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build plan9
package goos
const GOOS = `plan9`
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 = 1
const IsSolaris = 0
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build !illumos && solaris
package goos
const GOOS = `solaris`
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 = 1
const IsWasip1 = 0
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build wasip1
package goos
const GOOS = `wasip1`
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 = 1
const IsWindows = 0
const IsZos = 0

View File

@@ -0,0 +1,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build windows
package goos
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

View File

@@ -0,0 +1,26 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
//go:build zos
package goos
const GOOS = `zos`
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 = 0
const IsZos = 1