mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
internal/goarch, internal/goos: update generators for syslist.go
Update the generator programs for the changes to syslist.go in CL 390274 and the changes to the generated files in CL 344955. Tested by running the programs and verifying that the files did not change. Fixes #53299 Change-Id: I2b2c5769f7e9283aa05c803256d2ea1eb9ad1547 Reviewed-on: https://go-review.googlesource.com/c/go/+/411334 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
91baf5cecc
commit
b6c1606889
|
@ -4,6 +4,10 @@
|
|||
|
||||
package build
|
||||
|
||||
// Note that this file is read by internal/goarch/gengoarch.go and by
|
||||
// internal/goos/gengoos.go. If you change this file, look at those
|
||||
// files as well.
|
||||
|
||||
// knownOS is the list of past, present, and future known GOOS values.
|
||||
// Do not remove from this list, as it is used for filename matching.
|
||||
// If you add an entry to this list, look at unixOS, below.
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -22,14 +21,18 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
const goarchPrefix = `const goarchList = `
|
||||
const goarchPrefix = `var knownArch = map[string]bool{`
|
||||
inGOARCH := false
|
||||
for _, line := range strings.Split(string(data), "\n") {
|
||||
if strings.HasPrefix(line, goarchPrefix) {
|
||||
text, err := strconv.Unquote(strings.TrimPrefix(line, goarchPrefix))
|
||||
if err != nil {
|
||||
log.Fatalf("parsing goarchList: %v", err)
|
||||
}
|
||||
goarches = strings.Fields(text)
|
||||
inGOARCH = true
|
||||
} else if inGOARCH && strings.HasPrefix(line, "}") {
|
||||
break
|
||||
} else if inGOARCH {
|
||||
goarch := strings.Fields(line)[0]
|
||||
goarch = strings.TrimPrefix(goarch, `"`)
|
||||
goarch = strings.TrimSuffix(goarch, `":`)
|
||||
goarches = append(goarches, goarch)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +42,7 @@ func main() {
|
|||
}
|
||||
var buf bytes.Buffer
|
||||
fmt.Fprintf(&buf, "// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT.\n\n")
|
||||
fmt.Fprintf(&buf, "//go:build %s\n", target) // must explicitly include target for bootstrapping purposes
|
||||
fmt.Fprintf(&buf, "//go:build %s\n\n", target) // must explicitly include target for bootstrapping purposes
|
||||
fmt.Fprintf(&buf, "package goarch\n\n")
|
||||
fmt.Fprintf(&buf, "const GOARCH = `%s`\n\n", target)
|
||||
for _, goarch := range goarches {
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -22,14 +21,18 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
const goosPrefix = `const goosList = `
|
||||
const goosPrefix = `var knownOS = map[string]bool{`
|
||||
inGOOS := false
|
||||
for _, line := range strings.Split(string(data), "\n") {
|
||||
if strings.HasPrefix(line, goosPrefix) {
|
||||
text, err := strconv.Unquote(strings.TrimPrefix(line, goosPrefix))
|
||||
if err != nil {
|
||||
log.Fatalf("parsing goosList: %v", err)
|
||||
}
|
||||
gooses = strings.Fields(text)
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +53,7 @@ func main() {
|
|||
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", strings.Join(tags, " && "))
|
||||
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 {
|
||||
|
|
Loading…
Reference in a new issue