internal/buildcfg: move build configuration out of cmd/internal/objabi

The go/build package needs access to this configuration,
so move it into a new package available to the standard library.

Change-Id: I868a94148b52350c76116451f4ad9191246adcff
Reviewed-on: https://go-review.googlesource.com/c/go/+/310731
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
Russ Cox 2021-04-15 23:05:49 -04:00
parent 2fc0ebb623
commit 95ed5c3800
94 changed files with 674 additions and 549 deletions

View file

@ -8,6 +8,7 @@ import (
"bufio"
"flag"
"fmt"
"internal/buildcfg"
"log"
"os"
@ -18,14 +19,14 @@ import (
"cmd/internal/bio"
"cmd/internal/obj"
"cmd/internal/objabi"
)
func main() {
log.SetFlags(0)
log.SetPrefix("asm: ")
GOARCH := objabi.GOARCH
buildcfg.Check()
GOARCH := buildcfg.GOARCH
architecture := arch.Set(GOARCH)
if architecture == nil {
@ -68,7 +69,7 @@ func main() {
defer buf.Close()
if !*flags.SymABIs {
fmt.Fprintf(buf, "go object %s %s %s\n", objabi.GOOS, objabi.GOARCH, objabi.Version)
fmt.Fprintf(buf, "go object %s %s %s\n", buildcfg.GOOS, buildcfg.GOARCH, buildcfg.Version)
fmt.Fprintf(buf, "!\n")
}