mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
2fc0ebb623
commit
95ed5c3800
94 changed files with 674 additions and 549 deletions
|
|
@ -7,6 +7,7 @@ package noder
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"internal/buildcfg"
|
||||
"io"
|
||||
"os"
|
||||
pathpkg "path"
|
||||
|
|
@ -108,7 +109,7 @@ func openPackage(path string) (*os.File, error) {
|
|||
}
|
||||
}
|
||||
|
||||
if objabi.GOROOT != "" {
|
||||
if buildcfg.GOROOT != "" {
|
||||
suffix := ""
|
||||
if base.Flag.InstallSuffix != "" {
|
||||
suffix = "_" + base.Flag.InstallSuffix
|
||||
|
|
@ -118,10 +119,10 @@ func openPackage(path string) (*os.File, error) {
|
|||
suffix = "_msan"
|
||||
}
|
||||
|
||||
if file, err := os.Open(fmt.Sprintf("%s/pkg/%s_%s%s/%s.a", objabi.GOROOT, objabi.GOOS, objabi.GOARCH, suffix, path)); err == nil {
|
||||
if file, err := os.Open(fmt.Sprintf("%s/pkg/%s_%s%s/%s.a", buildcfg.GOROOT, buildcfg.GOOS, buildcfg.GOARCH, suffix, path)); err == nil {
|
||||
return file, nil
|
||||
}
|
||||
if file, err := os.Open(fmt.Sprintf("%s/pkg/%s_%s%s/%s.o", objabi.GOROOT, objabi.GOOS, objabi.GOARCH, suffix, path)); err == nil {
|
||||
if file, err := os.Open(fmt.Sprintf("%s/pkg/%s_%s%s/%s.o", buildcfg.GOROOT, buildcfg.GOOS, buildcfg.GOARCH, suffix, path)); err == nil {
|
||||
return file, nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue