cmd/go: make modifications to copies of go/build files for index

This change makes the modifications to the copies of the files of
go/build used by the modindex package needed for them to be used by
modindex. It also removes the parts of the files not needed by the
modindex package.

Change-Id: I72607868bd7e1ca5fc7c5a496cc836e7922e3786
Reviewed-on: https://go-review.googlesource.com/c/go/+/403974
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
This commit is contained in:
Michael Matloob 2022-04-05 18:47:23 -04:00
parent 1e5fcefcd1
commit 27ace7ab9e
5 changed files with 45 additions and 1064 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package build
// This file is a lightly modified copy go/build/read.go with unused parts
// removed.
package modindex
import (
"bufio"

View File

@ -1,10 +0,0 @@
package build
// This file is being added for this cl only just to get builds to pass and
// let the other files be submitted unchanged.
const defaultCGO_ENABLED = ""
var cgoEnabled = map[string]bool{}
func getToolDir() string { return "" }

View File

@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package build
// This file is a lightly modified copy go/build/syslist_test.go.
package modindex
// 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.

View File

@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package build
// This file is a lightly modified copy go/build/syslist_test.go.
package modindex
import (
"go/build"
"runtime"
"testing"
)
@ -55,7 +58,7 @@ var tests = []GoodFileTest{
func TestGoodOSArch(t *testing.T) {
for _, test := range tests {
if Default.goodOSArchFile(test.name, make(map[string]bool)) != test.result {
if (*Context)(&build.Default).goodOSArchFile(test.name, make(map[string]bool)) != test.result {
t.Fatalf("goodOSArchFile(%q) != %v", test.name, test.result)
}
}