mirror of https://github.com/golang/go.git
all: gofmt -w -r 'interface{} -> any' src
And then revert the bootstrap cmd directories and certain testdata.
And adjust tests as needed.
Not reverting the changes in std that are bootstrapped,
because some of those changes would appear in API docs,
and we want to use any consistently.
Instead, rewrite 'any' to 'interface{}' in cmd/dist for those directories
when preparing the bootstrap copy.
A few files changed as a result of running gofmt -w
not because of interface{} -> any but because they
hadn't been updated for the new //go:build lines.
Fixes #49884.
Change-Id: Ie8045cba995f65bd79c694ec77a1b3d1fe01bb09
Reviewed-on: https://go-review.googlesource.com/c/go/+/368254
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
083ef54624
commit
2580d0e08d
|
|
@ -538,7 +538,7 @@ type headerFileInfo struct {
|
||||||
func (fi headerFileInfo) Size() int64 { return fi.h.Size }
|
func (fi headerFileInfo) Size() int64 { return fi.h.Size }
|
||||||
func (fi headerFileInfo) IsDir() bool { return fi.Mode().IsDir() }
|
func (fi headerFileInfo) IsDir() bool { return fi.Mode().IsDir() }
|
||||||
func (fi headerFileInfo) ModTime() time.Time { return fi.h.ModTime }
|
func (fi headerFileInfo) ModTime() time.Time { return fi.h.ModTime }
|
||||||
func (fi headerFileInfo) Sys() interface{} { return fi.h }
|
func (fi headerFileInfo) Sys() any { return fi.h }
|
||||||
|
|
||||||
// Name returns the base name of the file.
|
// Name returns the base name of the file.
|
||||||
func (fi headerFileInfo) Name() string {
|
func (fi headerFileInfo) Name() string {
|
||||||
|
|
|
||||||
|
|
@ -1363,7 +1363,7 @@ func TestFileReader(t *testing.T) {
|
||||||
wantLCnt int64
|
wantLCnt int64
|
||||||
wantPCnt int64
|
wantPCnt int64
|
||||||
}
|
}
|
||||||
testFnc interface{} // testRead | testWriteTo | testRemaining
|
testFnc any // testRead | testWriteTo | testRemaining
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
@ -1376,7 +1376,7 @@ func TestFileReader(t *testing.T) {
|
||||||
spd sparseDatas
|
spd sparseDatas
|
||||||
size int64
|
size int64
|
||||||
}
|
}
|
||||||
fileMaker interface{} // makeReg | makeSparse
|
fileMaker any // makeReg | makeSparse
|
||||||
)
|
)
|
||||||
|
|
||||||
vectors := []struct {
|
vectors := []struct {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import (
|
||||||
|
|
||||||
type testError struct{ error }
|
type testError struct{ error }
|
||||||
|
|
||||||
type fileOps []interface{} // []T where T is (string | int64)
|
type fileOps []any // []T where T is (string | int64)
|
||||||
|
|
||||||
// testFile is an io.ReadWriteSeeker where the IO operations performed
|
// testFile is an io.ReadWriteSeeker where the IO operations performed
|
||||||
// on it must match the list of operations in ops.
|
// on it must match the list of operations in ops.
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ func TestWriter(t *testing.T) {
|
||||||
testClose struct { // Close() == wantErr
|
testClose struct { // Close() == wantErr
|
||||||
wantErr error
|
wantErr error
|
||||||
}
|
}
|
||||||
testFnc interface{} // testHeader | testWrite | testReadFrom | testClose
|
testFnc any // testHeader | testWrite | testReadFrom | testClose
|
||||||
)
|
)
|
||||||
|
|
||||||
vectors := []struct {
|
vectors := []struct {
|
||||||
|
|
@ -1031,7 +1031,7 @@ func TestFileWriter(t *testing.T) {
|
||||||
wantLCnt int64
|
wantLCnt int64
|
||||||
wantPCnt int64
|
wantPCnt int64
|
||||||
}
|
}
|
||||||
testFnc interface{} // testWrite | testReadFrom | testRemaining
|
testFnc any // testWrite | testReadFrom | testRemaining
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
@ -1044,7 +1044,7 @@ func TestFileWriter(t *testing.T) {
|
||||||
sph sparseHoles
|
sph sparseHoles
|
||||||
size int64
|
size int64
|
||||||
}
|
}
|
||||||
fileMaker interface{} // makeReg | makeSparse
|
fileMaker any // makeReg | makeSparse
|
||||||
)
|
)
|
||||||
|
|
||||||
vectors := []struct {
|
vectors := []struct {
|
||||||
|
|
|
||||||
|
|
@ -670,7 +670,7 @@ func (f *fileListEntry) Size() int64 { return 0 }
|
||||||
func (f *fileListEntry) Mode() fs.FileMode { return fs.ModeDir | 0555 }
|
func (f *fileListEntry) Mode() fs.FileMode { return fs.ModeDir | 0555 }
|
||||||
func (f *fileListEntry) Type() fs.FileMode { return fs.ModeDir }
|
func (f *fileListEntry) Type() fs.FileMode { return fs.ModeDir }
|
||||||
func (f *fileListEntry) IsDir() bool { return true }
|
func (f *fileListEntry) IsDir() bool { return true }
|
||||||
func (f *fileListEntry) Sys() interface{} { return nil }
|
func (f *fileListEntry) Sys() any { return nil }
|
||||||
|
|
||||||
func (f *fileListEntry) ModTime() time.Time {
|
func (f *fileListEntry) ModTime() time.Time {
|
||||||
if f.file == nil {
|
if f.file == nil {
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ func (fi headerFileInfo) ModTime() time.Time {
|
||||||
}
|
}
|
||||||
func (fi headerFileInfo) Mode() fs.FileMode { return fi.fh.Mode() }
|
func (fi headerFileInfo) Mode() fs.FileMode { return fi.fh.Mode() }
|
||||||
func (fi headerFileInfo) Type() fs.FileMode { return fi.fh.Mode().Type() }
|
func (fi headerFileInfo) Type() fs.FileMode { return fi.fh.Mode().Type() }
|
||||||
func (fi headerFileInfo) Sys() interface{} { return fi.fh }
|
func (fi headerFileInfo) Sys() any { return fi.fh }
|
||||||
|
|
||||||
func (fi headerFileInfo) Info() (fs.FileInfo, error) { return fi, nil }
|
func (fi headerFileInfo) Info() (fs.FileInfo, error) { return fi, nil }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ func close(c chan<- Type)
|
||||||
// that point, the program is terminated with a non-zero exit code. This
|
// that point, the program is terminated with a non-zero exit code. This
|
||||||
// termination sequence is called panicking and can be controlled by the
|
// termination sequence is called panicking and can be controlled by the
|
||||||
// built-in function recover.
|
// built-in function recover.
|
||||||
func panic(v interface{})
|
func panic(v any)
|
||||||
|
|
||||||
// The recover built-in function allows a program to manage behavior of a
|
// The recover built-in function allows a program to manage behavior of a
|
||||||
// panicking goroutine. Executing a call to recover inside a deferred
|
// panicking goroutine. Executing a call to recover inside a deferred
|
||||||
|
|
@ -250,7 +250,7 @@ func panic(v interface{})
|
||||||
// panicking, or if the argument supplied to panic was nil, recover returns
|
// panicking, or if the argument supplied to panic was nil, recover returns
|
||||||
// nil. Thus the return value from recover reports whether the goroutine is
|
// nil. Thus the return value from recover reports whether the goroutine is
|
||||||
// panicking.
|
// panicking.
|
||||||
func recover() interface{}
|
func recover() any
|
||||||
|
|
||||||
// The print built-in function formats its arguments in an
|
// The print built-in function formats its arguments in an
|
||||||
// implementation-specific way and writes the result to standard error.
|
// implementation-specific way and writes the result to standard error.
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ func TestReaderAt(t *testing.T) {
|
||||||
off int64
|
off int64
|
||||||
n int
|
n int
|
||||||
want string
|
want string
|
||||||
wanterr interface{}
|
wanterr any
|
||||||
}{
|
}{
|
||||||
{0, 10, "0123456789", nil},
|
{0, 10, "0123456789", nil},
|
||||||
{1, 10, "123456789", io.EOF},
|
{1, 10, "123456789", io.EOF},
|
||||||
|
|
|
||||||
|
|
@ -1071,7 +1071,7 @@ func (w *Walker) emitMethod(m *types.Selection) {
|
||||||
w.emitf("method (%s%s) %s%s", w.typeString(recv), tps, m.Obj().Name(), w.signatureString(sig))
|
w.emitf("method (%s%s) %s%s", w.typeString(recv), tps, m.Obj().Name(), w.signatureString(sig))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Walker) emitf(format string, args ...interface{}) {
|
func (w *Walker) emitf(format string, args ...any) {
|
||||||
f := strings.Join(w.scope, ", ") + ", " + fmt.Sprintf(format, args...)
|
f := strings.Join(w.scope, ", ") + ", " + fmt.Sprintf(format, args...)
|
||||||
if strings.Contains(f, "\n") {
|
if strings.Contains(f, "\n") {
|
||||||
panic("feature contains newlines: " + f)
|
panic("feature contains newlines: " + f)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build !amd64
|
||||||
// +build !amd64
|
// +build !amd64
|
||||||
|
|
||||||
package p
|
package p
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ var m map[string]int
|
||||||
|
|
||||||
var chanVar chan int
|
var chanVar chan int
|
||||||
|
|
||||||
var ifaceVar interface{} = 5
|
var ifaceVar any = 5
|
||||||
|
|
||||||
var assertVar = ifaceVar.(int)
|
var assertVar = ifaceVar.(int)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@
|
||||||
|
|
||||||
package p4
|
package p4
|
||||||
|
|
||||||
type Pair[T1 interface { M() }, T2 ~int] struct {
|
type Pair[T1 interface{ M() }, T2 ~int] struct {
|
||||||
f1 T1
|
f1 T1
|
||||||
f2 T2
|
f2 T2
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPair[T1 interface { M() }, T2 ~int](v1 T1, v2 T2) Pair[T1, T2] {
|
func NewPair[T1 interface{ M() }, T2 ~int](v1 T1, v2 T2) Pair[T1, T2] {
|
||||||
return Pair[T1, T2]{f1: v1, f2: v2}
|
return Pair[T1, T2]{f1: v1, f2: v2}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ var importedObjectTests = []struct {
|
||||||
{"go/internal/gcimporter.FindPkg", "func FindPkg(path string, srcDir string) (filename string, id string)"},
|
{"go/internal/gcimporter.FindPkg", "func FindPkg(path string, srcDir string) (filename string, id string)"},
|
||||||
|
|
||||||
// interfaces
|
// interfaces
|
||||||
{"context.Context", "type Context interface{Deadline() (deadline time.Time, ok bool); Done() <-chan struct{}; Err() error; Value(key interface{}) interface{}}"},
|
{"context.Context", "type Context interface{Deadline() (deadline time.Time, ok bool); Done() <-chan struct{}; Err() error; Value(key any) any}"},
|
||||||
{"crypto.Decrypter", "type Decrypter interface{Decrypt(rand io.Reader, msg []byte, opts DecrypterOpts) (plaintext []byte, err error); Public() PublicKey}"},
|
{"crypto.Decrypter", "type Decrypter interface{Decrypt(rand io.Reader, msg []byte, opts DecrypterOpts) (plaintext []byte, err error); Public() PublicKey}"},
|
||||||
{"encoding.BinaryMarshaler", "type BinaryMarshaler interface{MarshalBinary() (data []byte, err error)}"},
|
{"encoding.BinaryMarshaler", "type BinaryMarshaler interface{MarshalBinary() (data []byte, err error)}"},
|
||||||
{"io.Reader", "type Reader interface{Read(p []byte) (n int, err error)}"},
|
{"io.Reader", "type Reader interface{Read(p []byte) (n int, err error)}"},
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ func testSwitch() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testTypeSwitch() {
|
func testTypeSwitch() {
|
||||||
var x = []interface{}{1, 2.0, "hi"}
|
var x = []any{1, 2.0, "hi"}
|
||||||
for _, v := range x {
|
for _, v := range x {
|
||||||
switch func() { check(LINE, 3) }(); v.(type) {
|
switch func() { check(LINE, 3) }(); v.(type) {
|
||||||
case int:
|
case int:
|
||||||
|
|
@ -215,7 +215,7 @@ func testEmptySwitches() {
|
||||||
switch 3 {
|
switch 3 {
|
||||||
}
|
}
|
||||||
check(LINE, 1)
|
check(LINE, 1)
|
||||||
switch i := (interface{})(3).(int); i {
|
switch i := (any)(3).(int); i {
|
||||||
}
|
}
|
||||||
check(LINE, 1)
|
check(LINE, 1)
|
||||||
c := make(chan int)
|
c := make(chan int)
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
@ -288,7 +289,11 @@ func rewriteBlock%s(b *Block) bool { panic("unused during bootstrap") }
|
||||||
}
|
}
|
||||||
|
|
||||||
func bootstrapFixImports(srcFile string) string {
|
func bootstrapFixImports(srcFile string) string {
|
||||||
lines := strings.SplitAfter(readfile(srcFile), "\n")
|
text := readfile(srcFile)
|
||||||
|
if !strings.Contains(srcFile, "/cmd/") && !strings.Contains(srcFile, `\cmd\`) {
|
||||||
|
text = regexp.MustCompile(`\bany\b`).ReplaceAllString(text, "interface{}")
|
||||||
|
}
|
||||||
|
lines := strings.SplitAfter(text, "\n")
|
||||||
inBlock := false
|
inBlock := false
|
||||||
for i, line := range lines {
|
for i, line := range lines {
|
||||||
if strings.HasPrefix(line, "import (") {
|
if strings.HasPrefix(line, "import (") {
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ func trim(path, prefix string) (string, bool) {
|
||||||
// main do function, so it doesn't cause an exit. Allows testing to work
|
// main do function, so it doesn't cause an exit. Allows testing to work
|
||||||
// without running a subprocess. The log prefix will be added when
|
// without running a subprocess. The log prefix will be added when
|
||||||
// logged in main; it is not added here.
|
// logged in main; it is not added here.
|
||||||
func (pkg *Package) Fatalf(format string, args ...interface{}) {
|
func (pkg *Package) Fatalf(format string, args ...any) {
|
||||||
panic(PackageError(fmt.Sprintf(format, args...)))
|
panic(PackageError(fmt.Sprintf(format, args...)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,7 +209,7 @@ func parsePackage(writer io.Writer, pkg *build.Package, userPath string) *Packag
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pkg *Package) Printf(format string, args ...interface{}) {
|
func (pkg *Package) Printf(format string, args ...any) {
|
||||||
fmt.Fprintf(&pkg.buf, format, args...)
|
fmt.Fprintf(&pkg.buf, format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -235,7 +235,7 @@ func (pkg *Package) newlines(n int) {
|
||||||
// clears the stuff we don't want to print anyway. It's a bit of a magic trick.
|
// clears the stuff we don't want to print anyway. It's a bit of a magic trick.
|
||||||
func (pkg *Package) emit(comment string, node ast.Node) {
|
func (pkg *Package) emit(comment string, node ast.Node) {
|
||||||
if node != nil {
|
if node != nil {
|
||||||
var arg interface{} = node
|
var arg any = node
|
||||||
if showSrc {
|
if showSrc {
|
||||||
// Need an extra little dance to get internal comments to appear.
|
// Need an extra little dance to get internal comments to appear.
|
||||||
arg = &printer.CommentedNode{
|
arg = &printer.CommentedNode{
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// Ignored package
|
// Ignored package
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@ func typefix(f *ast.File, badType func(string) bool) bool {
|
||||||
|
|
||||||
// step 1: Find all the nils with the offending types.
|
// step 1: Find all the nils with the offending types.
|
||||||
// Compute their replacement.
|
// Compute their replacement.
|
||||||
badNils := map[interface{}]ast.Expr{}
|
badNils := map[any]ast.Expr{}
|
||||||
walk(f, func(n interface{}) {
|
walk(f, func(n any) {
|
||||||
if i, ok := n.(*ast.Ident); ok && i.Name == "nil" && badType(typeof[n]) {
|
if i, ok := n.(*ast.Ident); ok && i.Name == "nil" && badType(typeof[n]) {
|
||||||
badNils[n] = &ast.BasicLit{ValuePos: i.NamePos, Kind: token.INT, Value: "0"}
|
badNils[n] = &ast.BasicLit{ValuePos: i.NamePos, Kind: token.INT, Value: "0"}
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +58,7 @@ func typefix(f *ast.File, badType func(string) bool) bool {
|
||||||
if len(badNils) > 0 {
|
if len(badNils) > 0 {
|
||||||
exprType := reflect.TypeOf((*ast.Expr)(nil)).Elem()
|
exprType := reflect.TypeOf((*ast.Expr)(nil)).Elem()
|
||||||
exprSliceType := reflect.TypeOf(([]ast.Expr)(nil))
|
exprSliceType := reflect.TypeOf(([]ast.Expr)(nil))
|
||||||
walk(f, func(n interface{}) {
|
walk(f, func(n any) {
|
||||||
if n == nil {
|
if n == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -99,7 +99,7 @@ func typefix(f *ast.File, badType func(string) bool) bool {
|
||||||
// Now we need unsafe.Pointer as an intermediate cast.
|
// Now we need unsafe.Pointer as an intermediate cast.
|
||||||
// (*unsafe.Pointer)(x) where x is type *bad -> (*unsafe.Pointer)(unsafe.Pointer(x))
|
// (*unsafe.Pointer)(x) where x is type *bad -> (*unsafe.Pointer)(unsafe.Pointer(x))
|
||||||
// (*bad.type)(x) where x is type *unsafe.Pointer -> (*bad.type)(unsafe.Pointer(x))
|
// (*bad.type)(x) where x is type *unsafe.Pointer -> (*bad.type)(unsafe.Pointer(x))
|
||||||
walk(f, func(n interface{}) {
|
walk(f, func(n any) {
|
||||||
if n == nil {
|
if n == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,15 +43,15 @@ func register(f fix) {
|
||||||
// walk traverses the AST x, calling visit(y) for each node y in the tree but
|
// walk traverses the AST x, calling visit(y) for each node y in the tree but
|
||||||
// also with a pointer to each ast.Expr, ast.Stmt, and *ast.BlockStmt,
|
// also with a pointer to each ast.Expr, ast.Stmt, and *ast.BlockStmt,
|
||||||
// in a bottom-up traversal.
|
// in a bottom-up traversal.
|
||||||
func walk(x interface{}, visit func(interface{})) {
|
func walk(x any, visit func(any)) {
|
||||||
walkBeforeAfter(x, nop, visit)
|
walkBeforeAfter(x, nop, visit)
|
||||||
}
|
}
|
||||||
|
|
||||||
func nop(interface{}) {}
|
func nop(any) {}
|
||||||
|
|
||||||
// walkBeforeAfter is like walk but calls before(x) before traversing
|
// walkBeforeAfter is like walk but calls before(x) before traversing
|
||||||
// x's children and after(x) afterward.
|
// x's children and after(x) afterward.
|
||||||
func walkBeforeAfter(x interface{}, before, after func(interface{})) {
|
func walkBeforeAfter(x any, before, after func(any)) {
|
||||||
before(x)
|
before(x)
|
||||||
|
|
||||||
switch n := x.(type) {
|
switch n := x.(type) {
|
||||||
|
|
@ -390,7 +390,7 @@ func renameTop(f *ast.File, old, new string) bool {
|
||||||
// Rename top-level old to new, both unresolved names
|
// Rename top-level old to new, both unresolved names
|
||||||
// (probably defined in another file) and names that resolve
|
// (probably defined in another file) and names that resolve
|
||||||
// to a declaration we renamed.
|
// to a declaration we renamed.
|
||||||
walk(f, func(n interface{}) {
|
walk(f, func(n any) {
|
||||||
id, ok := n.(*ast.Ident)
|
id, ok := n.(*ast.Ident)
|
||||||
if ok && isTopName(id, old) {
|
if ok && isTopName(id, old) {
|
||||||
id.Name = new
|
id.Name = new
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ func fixGoExact(f *ast.File) bool {
|
||||||
// This one is harder because the import name changes.
|
// This one is harder because the import name changes.
|
||||||
// First find the import spec.
|
// First find the import spec.
|
||||||
var importSpec *ast.ImportSpec
|
var importSpec *ast.ImportSpec
|
||||||
walk(f, func(n interface{}) {
|
walk(f, func(n any) {
|
||||||
if importSpec != nil {
|
if importSpec != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ func processFile(filename string, useStdin bool) error {
|
||||||
return os.WriteFile(f.Name(), newSrc, 0)
|
return os.WriteFile(f.Name(), newSrc, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func gofmt(n interface{}) string {
|
func gofmt(n any) string {
|
||||||
var gofmtBuf bytes.Buffer
|
var gofmtBuf bytes.Buffer
|
||||||
if err := format.Node(&gofmtBuf, fset, n); err != nil {
|
if err := format.Node(&gofmtBuf, fset, n); err != nil {
|
||||||
return "<" + err.Error() + ">"
|
return "<" + err.Error() + ">"
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ func netipv6zone(f *ast.File) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed := false
|
fixed := false
|
||||||
walk(f, func(n interface{}) {
|
walk(f, func(n any) {
|
||||||
cl, ok := n.(*ast.CompositeLit)
|
cl, ok := n.(*ast.CompositeLit)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ func printerconfig(f *ast.File) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed := false
|
fixed := false
|
||||||
walk(f, func(n interface{}) {
|
walk(f, func(n any) {
|
||||||
cl, ok := n.(*ast.CompositeLit)
|
cl, ok := n.(*ast.CompositeLit)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -142,9 +142,9 @@ func (typ *Type) dot(cfg *TypeConfig, name string) string {
|
||||||
// typeof maps AST nodes to type information in gofmt string form.
|
// typeof maps AST nodes to type information in gofmt string form.
|
||||||
// assign maps type strings to lists of expressions that were assigned
|
// assign maps type strings to lists of expressions that were assigned
|
||||||
// to values of another type that were assigned to that type.
|
// to values of another type that were assigned to that type.
|
||||||
func typecheck(cfg *TypeConfig, f *ast.File) (typeof map[interface{}]string, assign map[string][]interface{}) {
|
func typecheck(cfg *TypeConfig, f *ast.File) (typeof map[any]string, assign map[string][]any) {
|
||||||
typeof = make(map[interface{}]string)
|
typeof = make(map[any]string)
|
||||||
assign = make(map[string][]interface{})
|
assign = make(map[string][]any)
|
||||||
cfg1 := &TypeConfig{}
|
cfg1 := &TypeConfig{}
|
||||||
*cfg1 = *cfg // make copy so we can add locally
|
*cfg1 = *cfg // make copy so we can add locally
|
||||||
copied := false
|
copied := false
|
||||||
|
|
@ -296,7 +296,7 @@ func makeExprList(a []*ast.Ident) []ast.Expr {
|
||||||
// Typecheck1 is the recursive form of typecheck.
|
// Typecheck1 is the recursive form of typecheck.
|
||||||
// It is like typecheck but adds to the information in typeof
|
// It is like typecheck but adds to the information in typeof
|
||||||
// instead of allocating a new map.
|
// instead of allocating a new map.
|
||||||
func typecheck1(cfg *TypeConfig, f interface{}, typeof map[interface{}]string, assign map[string][]interface{}) {
|
func typecheck1(cfg *TypeConfig, f any, typeof map[any]string, assign map[string][]any) {
|
||||||
// set sets the type of n to typ.
|
// set sets the type of n to typ.
|
||||||
// If isDecl is true, n is being declared.
|
// If isDecl is true, n is being declared.
|
||||||
set := func(n ast.Expr, typ string, isDecl bool) {
|
set := func(n ast.Expr, typ string, isDecl bool) {
|
||||||
|
|
@ -368,7 +368,7 @@ func typecheck1(cfg *TypeConfig, f interface{}, typeof map[interface{}]string, a
|
||||||
// the curfn stack.
|
// the curfn stack.
|
||||||
var curfn []*ast.FuncType
|
var curfn []*ast.FuncType
|
||||||
|
|
||||||
before := func(n interface{}) {
|
before := func(n any) {
|
||||||
// push function type on stack
|
// push function type on stack
|
||||||
switch n := n.(type) {
|
switch n := n.(type) {
|
||||||
case *ast.FuncDecl:
|
case *ast.FuncDecl:
|
||||||
|
|
@ -379,7 +379,7 @@ func typecheck1(cfg *TypeConfig, f interface{}, typeof map[interface{}]string, a
|
||||||
}
|
}
|
||||||
|
|
||||||
// After is the real type checker.
|
// After is the real type checker.
|
||||||
after := func(n interface{}) {
|
after := func(n any) {
|
||||||
if n == nil {
|
if n == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,12 +117,12 @@ func Exit() {
|
||||||
os.Exit(exitStatus)
|
os.Exit(exitStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Fatalf(format string, args ...interface{}) {
|
func Fatalf(format string, args ...any) {
|
||||||
Errorf(format, args...)
|
Errorf(format, args...)
|
||||||
Exit()
|
Exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
func Errorf(format string, args ...interface{}) {
|
func Errorf(format string, args ...any) {
|
||||||
log.Printf(format, args...)
|
log.Printf(format, args...)
|
||||||
SetExitStatus(1)
|
SetExitStatus(1)
|
||||||
}
|
}
|
||||||
|
|
@ -151,7 +151,7 @@ func GetExitStatus() int {
|
||||||
// Run runs the command, with stdout and stderr
|
// Run runs the command, with stdout and stderr
|
||||||
// connected to the go command's own stdout and stderr.
|
// connected to the go command's own stdout and stderr.
|
||||||
// If the command fails, Run reports the error using Errorf.
|
// If the command fails, Run reports the error using Errorf.
|
||||||
func Run(cmdargs ...interface{}) {
|
func Run(cmdargs ...any) {
|
||||||
cmdline := str.StringList(cmdargs...)
|
cmdline := str.StringList(cmdargs...)
|
||||||
if cfg.BuildN || cfg.BuildX {
|
if cfg.BuildN || cfg.BuildX {
|
||||||
fmt.Printf("%s\n", strings.Join(cmdline, " "))
|
fmt.Printf("%s\n", strings.Join(cmdline, " "))
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ func ParseOne(fs *flag.FlagSet, args []string) (f *flag.Flag, remainingArgs []st
|
||||||
// Use fs.Set instead of f.Value.Set below so that any subsequent call to
|
// Use fs.Set instead of f.Value.Set below so that any subsequent call to
|
||||||
// fs.Visit will correctly visit the flags that have been set.
|
// fs.Visit will correctly visit the flags that have been set.
|
||||||
|
|
||||||
failf := func(format string, a ...interface{}) (*flag.Flag, []string, error) {
|
failf := func(format string, a ...any) (*flag.Flag, []string, error) {
|
||||||
return f, args, fmt.Errorf(format, a...)
|
return f, args, fmt.Errorf(format, a...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -499,7 +499,7 @@ func (f fakeFile) Size() int64 { return f.real.Size() }
|
||||||
func (f fakeFile) Mode() fs.FileMode { return f.real.Mode() }
|
func (f fakeFile) Mode() fs.FileMode { return f.real.Mode() }
|
||||||
func (f fakeFile) ModTime() time.Time { return f.real.ModTime() }
|
func (f fakeFile) ModTime() time.Time { return f.real.ModTime() }
|
||||||
func (f fakeFile) IsDir() bool { return f.real.IsDir() }
|
func (f fakeFile) IsDir() bool { return f.real.IsDir() }
|
||||||
func (f fakeFile) Sys() interface{} { return f.real.Sys() }
|
func (f fakeFile) Sys() any { return f.real.Sys() }
|
||||||
|
|
||||||
// missingFile provides an fs.FileInfo for an overlaid file where the
|
// missingFile provides an fs.FileInfo for an overlaid file where the
|
||||||
// destination file in the overlay doesn't exist. It returns zero values
|
// destination file in the overlay doesn't exist. It returns zero values
|
||||||
|
|
@ -512,7 +512,7 @@ func (f missingFile) Size() int64 { return 0 }
|
||||||
func (f missingFile) Mode() fs.FileMode { return fs.ModeIrregular }
|
func (f missingFile) Mode() fs.FileMode { return fs.ModeIrregular }
|
||||||
func (f missingFile) ModTime() time.Time { return time.Unix(0, 0) }
|
func (f missingFile) ModTime() time.Time { return time.Unix(0, 0) }
|
||||||
func (f missingFile) IsDir() bool { return false }
|
func (f missingFile) IsDir() bool { return false }
|
||||||
func (f missingFile) Sys() interface{} { return nil }
|
func (f missingFile) Sys() any { return nil }
|
||||||
|
|
||||||
// fakeDir provides an fs.FileInfo implementation for directories that are
|
// fakeDir provides an fs.FileInfo implementation for directories that are
|
||||||
// implicitly created by overlaid files. Each directory in the
|
// implicitly created by overlaid files. Each directory in the
|
||||||
|
|
@ -524,7 +524,7 @@ func (f fakeDir) Size() int64 { return 0 }
|
||||||
func (f fakeDir) Mode() fs.FileMode { return fs.ModeDir | 0500 }
|
func (f fakeDir) Mode() fs.FileMode { return fs.ModeDir | 0500 }
|
||||||
func (f fakeDir) ModTime() time.Time { return time.Unix(0, 0) }
|
func (f fakeDir) ModTime() time.Time { return time.Unix(0, 0) }
|
||||||
func (f fakeDir) IsDir() bool { return true }
|
func (f fakeDir) IsDir() bool { return true }
|
||||||
func (f fakeDir) Sys() interface{} { return nil }
|
func (f fakeDir) Sys() any { return nil }
|
||||||
|
|
||||||
// Glob is like filepath.Glob but uses the overlay file system.
|
// Glob is like filepath.Glob but uses the overlay file system.
|
||||||
func Glob(pattern string) (matches []string, err error) {
|
func Glob(pattern string) (matches []string, err error) {
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,7 @@ var stop = fmt.Errorf("error in generation")
|
||||||
// errorf logs an error message prefixed with the file and line number.
|
// errorf logs an error message prefixed with the file and line number.
|
||||||
// It then exits the program (with exit status 1) because generation stops
|
// It then exits the program (with exit status 1) because generation stops
|
||||||
// at the first error.
|
// at the first error.
|
||||||
func (g *Generator) errorf(format string, args ...interface{}) {
|
func (g *Generator) errorf(format string, args ...any) {
|
||||||
fmt.Fprintf(os.Stderr, "%s:%d: %s\n", base.ShortPath(g.path), g.lineNum,
|
fmt.Fprintf(os.Stderr, "%s:%d: %s\n", base.ShortPath(g.path), g.lineNum,
|
||||||
fmt.Sprintf(format, args...))
|
fmt.Sprintf(format, args...))
|
||||||
panic(stop)
|
panic(stop)
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ func (w *errWriter) Write(b []byte) (int, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// tmpl executes the given template text on data, writing the result to w.
|
// tmpl executes the given template text on data, writing the result to w.
|
||||||
func tmpl(w io.Writer, text string, data interface{}) {
|
func tmpl(w io.Writer, text string, data any) {
|
||||||
t := template.New("top")
|
t := template.New("top")
|
||||||
t.Funcs(template.FuncMap{"trim": strings.TrimSpace, "capitalize": capitalize})
|
t.Funcs(template.FuncMap{"trim": strings.TrimSpace, "capitalize": capitalize})
|
||||||
template.Must(t.Parse(text))
|
template.Must(t.Parse(text))
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build android
|
||||||
// +build android
|
// +build android
|
||||||
|
|
||||||
package android
|
package android
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build linux
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package android
|
package android
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build !android
|
||||||
// +build !android
|
// +build !android
|
||||||
|
|
||||||
package android
|
package android
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build illumos
|
||||||
// +build illumos
|
// +build illumos
|
||||||
|
|
||||||
package illumos
|
package illumos
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build solaris
|
||||||
// +build solaris
|
// +build solaris
|
||||||
|
|
||||||
package illumos
|
package illumos
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build !illumos
|
||||||
// +build !illumos
|
// +build !illumos
|
||||||
|
|
||||||
package illumos
|
package illumos
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
// +build blahblh
|
//go:build blahblh && linux && !linux && windows && darwin
|
||||||
// +build linux
|
// +build blahblh,linux,!linux,windows,darwin
|
||||||
// +build !linux
|
|
||||||
// +build windows
|
|
||||||
// +build darwin
|
|
||||||
|
|
||||||
package x
|
package x
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -358,9 +358,9 @@ func runList(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var do func(interface{})
|
var do func(any)
|
||||||
if *listJson {
|
if *listJson {
|
||||||
do = func(x interface{}) {
|
do = func(x any) {
|
||||||
b, err := json.MarshalIndent(x, "", "\t")
|
b, err := json.MarshalIndent(x, "", "\t")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
out.Flush()
|
out.Flush()
|
||||||
|
|
@ -386,7 +386,7 @@ func runList(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
base.Fatalf("%s", err)
|
base.Fatalf("%s", err)
|
||||||
}
|
}
|
||||||
do = func(x interface{}) {
|
do = func(x any) {
|
||||||
if err := tmpl.Execute(out, x); err != nil {
|
if err := tmpl.Execute(out, x); err != nil {
|
||||||
out.Flush()
|
out.Flush()
|
||||||
base.Fatalf("%s", err)
|
base.Fatalf("%s", err)
|
||||||
|
|
|
||||||
|
|
@ -498,7 +498,7 @@ type importError struct {
|
||||||
err error // created with fmt.Errorf
|
err error // created with fmt.Errorf
|
||||||
}
|
}
|
||||||
|
|
||||||
func ImportErrorf(path, format string, args ...interface{}) ImportPathError {
|
func ImportErrorf(path, format string, args ...any) ImportPathError {
|
||||||
err := &importError{importPath: path, err: fmt.Errorf(format, args...)}
|
err := &importError{importPath: path, err: fmt.Errorf(format, args...)}
|
||||||
if errStr := err.Error(); !strings.Contains(errStr, path) {
|
if errStr := err.Error(); !strings.Contains(errStr, path) {
|
||||||
panic(fmt.Sprintf("path %q not in error %q", path, errStr))
|
panic(fmt.Sprintf("path %q not in error %q", path, errStr))
|
||||||
|
|
@ -589,10 +589,10 @@ func ClearPackageCachePartial(args []string) {
|
||||||
delete(packageCache, arg)
|
delete(packageCache, arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resolvedImportCache.DeleteIf(func(key interface{}) bool {
|
resolvedImportCache.DeleteIf(func(key any) bool {
|
||||||
return shouldDelete[key.(importSpec).path]
|
return shouldDelete[key.(importSpec).path]
|
||||||
})
|
})
|
||||||
packageDataCache.DeleteIf(func(key interface{}) bool {
|
packageDataCache.DeleteIf(func(key any) bool {
|
||||||
return shouldDelete[key.(string)]
|
return shouldDelete[key.(string)]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -605,7 +605,7 @@ func ReloadPackageNoFlags(arg string, stk *ImportStack) *Package {
|
||||||
p := packageCache[arg]
|
p := packageCache[arg]
|
||||||
if p != nil {
|
if p != nil {
|
||||||
delete(packageCache, arg)
|
delete(packageCache, arg)
|
||||||
resolvedImportCache.DeleteIf(func(key interface{}) bool {
|
resolvedImportCache.DeleteIf(func(key any) bool {
|
||||||
return key.(importSpec).path == p.ImportPath
|
return key.(importSpec).path == p.ImportPath
|
||||||
})
|
})
|
||||||
packageDataCache.Delete(p.ImportPath)
|
packageDataCache.Delete(p.ImportPath)
|
||||||
|
|
@ -817,7 +817,7 @@ func loadPackageData(ctx context.Context, path, parentPath, parentDir, parentRoo
|
||||||
parentIsStd: parentIsStd,
|
parentIsStd: parentIsStd,
|
||||||
mode: mode,
|
mode: mode,
|
||||||
}
|
}
|
||||||
r := resolvedImportCache.Do(importKey, func() interface{} {
|
r := resolvedImportCache.Do(importKey, func() any {
|
||||||
var r resolvedImport
|
var r resolvedImport
|
||||||
if build.IsLocalImport(path) {
|
if build.IsLocalImport(path) {
|
||||||
r.dir = filepath.Join(parentDir, path)
|
r.dir = filepath.Join(parentDir, path)
|
||||||
|
|
@ -844,7 +844,7 @@ func loadPackageData(ctx context.Context, path, parentPath, parentDir, parentRoo
|
||||||
|
|
||||||
// Load the package from its directory. If we already found the package's
|
// Load the package from its directory. If we already found the package's
|
||||||
// directory when resolving its import path, use that.
|
// directory when resolving its import path, use that.
|
||||||
data := packageDataCache.Do(r.path, func() interface{} {
|
data := packageDataCache.Do(r.path, func() any {
|
||||||
loaded = true
|
loaded = true
|
||||||
var data packageData
|
var data packageData
|
||||||
if r.dir != "" {
|
if r.dir != "" {
|
||||||
|
|
@ -1063,7 +1063,7 @@ func cleanImport(path string) string {
|
||||||
var isDirCache par.Cache
|
var isDirCache par.Cache
|
||||||
|
|
||||||
func isDir(path string) bool {
|
func isDir(path string) bool {
|
||||||
return isDirCache.Do(path, func() interface{} {
|
return isDirCache.Do(path, func() any {
|
||||||
fi, err := fsys.Stat(path)
|
fi, err := fsys.Stat(path)
|
||||||
return err == nil && fi.IsDir()
|
return err == nil && fi.IsDir()
|
||||||
}).(bool)
|
}).(bool)
|
||||||
|
|
@ -1191,7 +1191,7 @@ var (
|
||||||
|
|
||||||
// goModPath returns the module path in the go.mod in dir, if any.
|
// goModPath returns the module path in the go.mod in dir, if any.
|
||||||
func goModPath(dir string) (path string) {
|
func goModPath(dir string) (path string) {
|
||||||
return goModPathCache.Do(dir, func() interface{} {
|
return goModPathCache.Do(dir, func() any {
|
||||||
data, err := os.ReadFile(filepath.Join(dir, "go.mod"))
|
data, err := os.ReadFile(filepath.Join(dir, "go.mod"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
|
|
@ -2221,7 +2221,7 @@ func (p *Package) setBuildInfo() {
|
||||||
// executables always appear stale unless the user sets the same flags.
|
// executables always appear stale unless the user sets the same flags.
|
||||||
// Perhaps it's safe to omit those flags when GO_GCFLAGS and GO_LDFLAGS
|
// Perhaps it's safe to omit those flags when GO_GCFLAGS and GO_LDFLAGS
|
||||||
// are not set?
|
// are not set?
|
||||||
setPkgErrorf := func(format string, args ...interface{}) {
|
setPkgErrorf := func(format string, args ...any) {
|
||||||
if p.Error == nil {
|
if p.Error == nil {
|
||||||
p.Error = &PackageError{Err: fmt.Errorf(format, args...)}
|
p.Error = &PackageError{Err: fmt.Errorf(format, args...)}
|
||||||
}
|
}
|
||||||
|
|
@ -2397,7 +2397,7 @@ func (p *Package) setBuildInfo() {
|
||||||
Status vcs.Status
|
Status vcs.Status
|
||||||
Err error
|
Err error
|
||||||
}
|
}
|
||||||
cached := vcsStatusCache.Do(repoDir, func() interface{} {
|
cached := vcsStatusCache.Do(repoDir, func() any {
|
||||||
st, err := vcsCmd.Status(vcsCmd, repoDir)
|
st, err := vcsCmd.Status(vcsCmd, repoDir)
|
||||||
return vcsStatusError{st, err}
|
return vcsStatusError{st, err}
|
||||||
}).(vcsStatusError)
|
}).(vcsStatusError)
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,8 @@ type goVersionFlag struct {
|
||||||
v string
|
v string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *goVersionFlag) String() string { return f.v }
|
func (f *goVersionFlag) String() string { return f.v }
|
||||||
func (f *goVersionFlag) Get() interface{} { return f.v }
|
func (f *goVersionFlag) Get() any { return f.v }
|
||||||
|
|
||||||
func (f *goVersionFlag) Set(s string) error {
|
func (f *goVersionFlag) Set(s string) error {
|
||||||
if s != "" {
|
if s != "" {
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ func (r *cachingRepo) Versions(prefix string) ([]string, error) {
|
||||||
list []string
|
list []string
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
c := r.cache.Do("versions:"+prefix, func() interface{} {
|
c := r.cache.Do("versions:"+prefix, func() any {
|
||||||
list, err := r.repo().Versions(prefix)
|
list, err := r.repo().Versions(prefix)
|
||||||
return cached{list, err}
|
return cached{list, err}
|
||||||
}).(cached)
|
}).(cached)
|
||||||
|
|
@ -221,7 +221,7 @@ type cachedInfo struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *cachingRepo) Stat(rev string) (*RevInfo, error) {
|
func (r *cachingRepo) Stat(rev string) (*RevInfo, error) {
|
||||||
c := r.cache.Do("stat:"+rev, func() interface{} {
|
c := r.cache.Do("stat:"+rev, func() any {
|
||||||
file, info, err := readDiskStat(r.path, rev)
|
file, info, err := readDiskStat(r.path, rev)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return cachedInfo{info, nil}
|
return cachedInfo{info, nil}
|
||||||
|
|
@ -233,7 +233,7 @@ func (r *cachingRepo) Stat(rev string) (*RevInfo, error) {
|
||||||
// then save the information under the proper version, for future use.
|
// then save the information under the proper version, for future use.
|
||||||
if info.Version != rev {
|
if info.Version != rev {
|
||||||
file, _ = CachePath(module.Version{Path: r.path, Version: info.Version}, "info")
|
file, _ = CachePath(module.Version{Path: r.path, Version: info.Version}, "info")
|
||||||
r.cache.Do("stat:"+info.Version, func() interface{} {
|
r.cache.Do("stat:"+info.Version, func() any {
|
||||||
return cachedInfo{info, err}
|
return cachedInfo{info, err}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -253,12 +253,12 @@ func (r *cachingRepo) Stat(rev string) (*RevInfo, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *cachingRepo) Latest() (*RevInfo, error) {
|
func (r *cachingRepo) Latest() (*RevInfo, error) {
|
||||||
c := r.cache.Do("latest:", func() interface{} {
|
c := r.cache.Do("latest:", func() any {
|
||||||
info, err := r.repo().Latest()
|
info, err := r.repo().Latest()
|
||||||
|
|
||||||
// Save info for likely future Stat call.
|
// Save info for likely future Stat call.
|
||||||
if err == nil {
|
if err == nil {
|
||||||
r.cache.Do("stat:"+info.Version, func() interface{} {
|
r.cache.Do("stat:"+info.Version, func() any {
|
||||||
return cachedInfo{info, err}
|
return cachedInfo{info, err}
|
||||||
})
|
})
|
||||||
if file, _, err := readDiskStat(r.path, info.Version); err != nil {
|
if file, _, err := readDiskStat(r.path, info.Version); err != nil {
|
||||||
|
|
@ -281,7 +281,7 @@ func (r *cachingRepo) GoMod(version string) ([]byte, error) {
|
||||||
text []byte
|
text []byte
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
c := r.cache.Do("gomod:"+version, func() interface{} {
|
c := r.cache.Do("gomod:"+version, func() any {
|
||||||
file, text, err := readDiskGoMod(r.path, version)
|
file, text, err := readDiskGoMod(r.path, version)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// Note: readDiskGoMod already called checkGoMod.
|
// Note: readDiskGoMod already called checkGoMod.
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,7 @@ var dirLock sync.Map
|
||||||
// It returns the standard output and, for a non-zero exit,
|
// It returns the standard output and, for a non-zero exit,
|
||||||
// a *RunError indicating the command, exit status, and standard error.
|
// a *RunError indicating the command, exit status, and standard error.
|
||||||
// Standard error is unavailable for commands that exit successfully.
|
// Standard error is unavailable for commands that exit successfully.
|
||||||
func Run(dir string, cmdline ...interface{}) ([]byte, error) {
|
func Run(dir string, cmdline ...any) ([]byte, error) {
|
||||||
return RunWithStdin(dir, nil, cmdline...)
|
return RunWithStdin(dir, nil, cmdline...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -236,7 +236,7 @@ func Run(dir string, cmdline ...interface{}) ([]byte, error) {
|
||||||
// See https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html.
|
// See https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html.
|
||||||
var bashQuoter = strings.NewReplacer(`"`, `\"`, `$`, `\$`, "`", "\\`", `\`, `\\`)
|
var bashQuoter = strings.NewReplacer(`"`, `\"`, `$`, `\$`, "`", "\\`", `\`, `\\`)
|
||||||
|
|
||||||
func RunWithStdin(dir string, stdin io.Reader, cmdline ...interface{}) ([]byte, error) {
|
func RunWithStdin(dir string, stdin io.Reader, cmdline ...any) ([]byte, error) {
|
||||||
if dir != "" {
|
if dir != "" {
|
||||||
muIface, ok := dirLock.Load(dir)
|
muIface, ok := dirLock.Load(dir)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ func newGitRepoCached(remote string, localOK bool) (Repo, error) {
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
|
||||||
c := gitRepoCache.Do(key{remote, localOK}, func() interface{} {
|
c := gitRepoCache.Do(key{remote, localOK}, func() any {
|
||||||
repo, err := newGitRepo(remote, localOK)
|
repo, err := newGitRepo(remote, localOK)
|
||||||
return cached{repo, err}
|
return cached{repo, err}
|
||||||
}).(cached)
|
}).(cached)
|
||||||
|
|
@ -503,7 +503,7 @@ func (r *gitRepo) Stat(rev string) (*RevInfo, error) {
|
||||||
info *RevInfo
|
info *RevInfo
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
c := r.statCache.Do(rev, func() interface{} {
|
c := r.statCache.Do(rev, func() any {
|
||||||
info, err := r.stat(rev)
|
info, err := r.stat(rev)
|
||||||
return cached{info, err}
|
return cached{info, err}
|
||||||
}).(cached)
|
}).(cached)
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ type VCSError struct {
|
||||||
|
|
||||||
func (e *VCSError) Error() string { return e.Err.Error() }
|
func (e *VCSError) Error() string { return e.Err.Error() }
|
||||||
|
|
||||||
func vcsErrorf(format string, a ...interface{}) error {
|
func vcsErrorf(format string, a ...any) error {
|
||||||
return &VCSError{Err: fmt.Errorf(format, a...)}
|
return &VCSError{Err: fmt.Errorf(format, a...)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ func NewRepo(vcs, remote string) (Repo, error) {
|
||||||
repo Repo
|
repo Repo
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
c := vcsRepoCache.Do(key{vcs, remote}, func() interface{} {
|
c := vcsRepoCache.Do(key{vcs, remote}, func() any {
|
||||||
repo, err := newVCSRepo(vcs, remote)
|
repo, err := newVCSRepo(vcs, remote)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = &VCSError{err}
|
err = &VCSError{err}
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,7 @@ func (r *codeRepo) convert(info *codehost.RevInfo, statVers string) (*RevInfo, e
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
invalidf := func(format string, args ...interface{}) error {
|
invalidf := func(format string, args ...any) error {
|
||||||
return &module.ModuleError{
|
return &module.ModuleError{
|
||||||
Path: r.modPath,
|
Path: r.modPath,
|
||||||
Err: &module.InvalidVersionError{
|
Err: &module.InvalidVersionError{
|
||||||
|
|
@ -1066,7 +1066,7 @@ func (fi dataFileInfo) Size() int64 { return int64(len(fi.f.data)) }
|
||||||
func (fi dataFileInfo) Mode() fs.FileMode { return 0644 }
|
func (fi dataFileInfo) Mode() fs.FileMode { return 0644 }
|
||||||
func (fi dataFileInfo) ModTime() time.Time { return time.Time{} }
|
func (fi dataFileInfo) ModTime() time.Time { return time.Time{} }
|
||||||
func (fi dataFileInfo) IsDir() bool { return false }
|
func (fi dataFileInfo) IsDir() bool { return false }
|
||||||
func (fi dataFileInfo) Sys() interface{} { return nil }
|
func (fi dataFileInfo) Sys() any { return nil }
|
||||||
|
|
||||||
// hasPathPrefix reports whether the path s begins with the
|
// hasPathPrefix reports whether the path s begins with the
|
||||||
// elements in prefix.
|
// elements in prefix.
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ func Download(ctx context.Context, mod module.Version) (dir string, err error) {
|
||||||
dir string
|
dir string
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
c := downloadCache.Do(mod, func() interface{} {
|
c := downloadCache.Do(mod, func() any {
|
||||||
dir, err := download(ctx, mod)
|
dir, err := download(ctx, mod)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cached{"", err}
|
return cached{"", err}
|
||||||
|
|
@ -165,7 +165,7 @@ func DownloadZip(ctx context.Context, mod module.Version) (zipfile string, err e
|
||||||
zipfile string
|
zipfile string
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
c := downloadZipCache.Do(mod, func() interface{} {
|
c := downloadZipCache.Do(mod, func() any {
|
||||||
zipfile, err := CachePath(mod, "zip")
|
zipfile, err := CachePath(mod, "zip")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cached{"", err}
|
return cached{"", err}
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ func Lookup(proxy, path string) Repo {
|
||||||
type cached struct {
|
type cached struct {
|
||||||
r Repo
|
r Repo
|
||||||
}
|
}
|
||||||
c := lookupCache.Do(lookupCacheKey{proxy, path}, func() interface{} {
|
c := lookupCache.Do(lookupCacheKey{proxy, path}, func() any {
|
||||||
r := newCachingRepo(path, func() (Repo, error) {
|
r := newCachingRepo(path, func() (Repo, error) {
|
||||||
r, err := lookup(proxy, path)
|
r, err := lookup(proxy, path)
|
||||||
if err == nil && traceRepo {
|
if err == nil && traceRepo {
|
||||||
|
|
@ -308,7 +308,7 @@ func newLoggingRepo(r Repo) *loggingRepo {
|
||||||
// defer logCall("hello %s", arg)()
|
// defer logCall("hello %s", arg)()
|
||||||
//
|
//
|
||||||
// Note the final ().
|
// Note the final ().
|
||||||
func logCall(format string, args ...interface{}) func() {
|
func logCall(format string, args ...any) func() {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
fmt.Fprintf(os.Stderr, "+++ %s\n", fmt.Sprintf(format, args...))
|
fmt.Fprintf(os.Stderr, "+++ %s\n", fmt.Sprintf(format, args...))
|
||||||
return func() {
|
return func() {
|
||||||
|
|
@ -371,7 +371,7 @@ type notExistError struct {
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
|
||||||
func notExistErrorf(format string, args ...interface{}) error {
|
func notExistErrorf(format string, args ...any) error {
|
||||||
return notExistError{fmt.Errorf(format, args...)}
|
return notExistError{fmt.Errorf(format, args...)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -601,7 +601,7 @@ func (r *resolver) matchInModule(ctx context.Context, pattern string, m module.V
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
|
||||||
e := r.matchInModuleCache.Do(key{pattern, m}, func() interface{} {
|
e := r.matchInModuleCache.Do(key{pattern, m}, func() any {
|
||||||
match := modload.MatchInModule(ctx, pattern, m, imports.AnyTags())
|
match := modload.MatchInModule(ctx, pattern, m, imports.AnyTags())
|
||||||
if len(match.Errs) > 0 {
|
if len(match.Errs) > 0 {
|
||||||
return entry{match.Pkgs, match.Errs[0]}
|
return entry{match.Pkgs, match.Errs[0]}
|
||||||
|
|
@ -893,7 +893,7 @@ func (r *resolver) checkWildcardVersions(ctx context.Context) {
|
||||||
// curM at its original version contains a path matching q.pattern,
|
// curM at its original version contains a path matching q.pattern,
|
||||||
// but at rev.Version it does not, so (somewhat paradoxically) if
|
// but at rev.Version it does not, so (somewhat paradoxically) if
|
||||||
// we changed the version of curM it would no longer match the query.
|
// we changed the version of curM it would no longer match the query.
|
||||||
var version interface{} = m
|
var version any = m
|
||||||
if rev.Version != q.version {
|
if rev.Version != q.version {
|
||||||
version = fmt.Sprintf("%s@%s (%s)", m.Path, q.version, m.Version)
|
version = fmt.Sprintf("%s@%s (%s)", m.Path, q.version, m.Version)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ func readModGraph(ctx context.Context, pruning modPruning, roots []module.Versio
|
||||||
// It does not load the transitive requirements of m even if the go version in
|
// It does not load the transitive requirements of m even if the go version in
|
||||||
// m's go.mod file indicates that it supports graph pruning.
|
// m's go.mod file indicates that it supports graph pruning.
|
||||||
loadOne := func(m module.Version) (*modFileSummary, error) {
|
loadOne := func(m module.Version) (*modFileSummary, error) {
|
||||||
cached := mg.loadCache.Do(m, func() interface{} {
|
cached := mg.loadCache.Do(m, func() any {
|
||||||
summary, err := goModSummary(m)
|
summary, err := goModSummary(m)
|
||||||
|
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
|
|
|
||||||
|
|
@ -612,7 +612,7 @@ func dirInModule(path, mpath, mdir string, isLocal bool) (dir string, haveGoFile
|
||||||
// (the main module, and any directory trees pointed at by replace directives).
|
// (the main module, and any directory trees pointed at by replace directives).
|
||||||
if isLocal {
|
if isLocal {
|
||||||
for d := dir; d != mdir && len(d) > len(mdir); {
|
for d := dir; d != mdir && len(d) > len(mdir); {
|
||||||
haveGoMod := haveGoModCache.Do(d, func() interface{} {
|
haveGoMod := haveGoModCache.Do(d, func() any {
|
||||||
fi, err := fsys.Stat(filepath.Join(d, "go.mod"))
|
fi, err := fsys.Stat(filepath.Join(d, "go.mod"))
|
||||||
return err == nil && !fi.IsDir()
|
return err == nil && !fi.IsDir()
|
||||||
}).(bool)
|
}).(bool)
|
||||||
|
|
@ -635,7 +635,7 @@ func dirInModule(path, mpath, mdir string, isLocal bool) (dir string, haveGoFile
|
||||||
// Are there Go source files in the directory?
|
// Are there Go source files in the directory?
|
||||||
// We don't care about build tags, not even "+build ignore".
|
// We don't care about build tags, not even "+build ignore".
|
||||||
// We're just looking for a plausible directory.
|
// We're just looking for a plausible directory.
|
||||||
res := haveGoFilesCache.Do(dir, func() interface{} {
|
res := haveGoFilesCache.Do(dir, func() any {
|
||||||
ok, err := fsys.IsDirWithGoFiles(dir)
|
ok, err := fsys.IsDirWithGoFiles(dir)
|
||||||
return goFilesEntry{haveGoFiles: ok, err: err}
|
return goFilesEntry{haveGoFiles: ok, err: err}
|
||||||
}).(goFilesEntry)
|
}).(goFilesEntry)
|
||||||
|
|
|
||||||
|
|
@ -859,7 +859,7 @@ func (ld *loader) reset() {
|
||||||
|
|
||||||
// errorf reports an error via either os.Stderr or base.Errorf,
|
// errorf reports an error via either os.Stderr or base.Errorf,
|
||||||
// according to whether ld.AllowErrors is set.
|
// according to whether ld.AllowErrors is set.
|
||||||
func (ld *loader) errorf(format string, args ...interface{}) {
|
func (ld *loader) errorf(format string, args ...any) {
|
||||||
if ld.AllowErrors {
|
if ld.AllowErrors {
|
||||||
fmt.Fprintf(os.Stderr, format, args...)
|
fmt.Fprintf(os.Stderr, format, args...)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1492,7 +1492,7 @@ func (ld *loader) pkg(ctx context.Context, path string, flags loadPkgFlags) *loa
|
||||||
panic("internal error: (*loader).pkg called with pkgImportsLoaded flag set")
|
panic("internal error: (*loader).pkg called with pkgImportsLoaded flag set")
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg := ld.pkgCache.Do(path, func() interface{} {
|
pkg := ld.pkgCache.Do(path, func() any {
|
||||||
pkg := &loadPkg{
|
pkg := &loadPkg{
|
||||||
path: path,
|
path: path,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -664,7 +664,7 @@ func rawGoModSummary(m module.Version) (*modFileSummary, error) {
|
||||||
summary *modFileSummary
|
summary *modFileSummary
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
c := rawGoModSummaryCache.Do(key{m}, func() interface{} {
|
c := rawGoModSummaryCache.Do(key{m}, func() any {
|
||||||
summary := new(modFileSummary)
|
summary := new(modFileSummary)
|
||||||
name, data, err := rawGoModData(m)
|
name, data, err := rawGoModData(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -766,7 +766,7 @@ func queryLatestVersionIgnoringRetractions(ctx context.Context, path string) (la
|
||||||
latest module.Version
|
latest module.Version
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
e := latestVersionIgnoringRetractionsCache.Do(path, func() interface{} {
|
e := latestVersionIgnoringRetractionsCache.Do(path, func() any {
|
||||||
ctx, span := trace.StartSpan(ctx, "queryLatestVersionIgnoringRetractions "+path)
|
ctx, span := trace.StartSpan(ctx, "queryLatestVersionIgnoringRetractions "+path)
|
||||||
defer span.Done()
|
defer span.Done()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ func checkVendorConsistency(index *modFileIndex, modFile *modfile.File) {
|
||||||
}
|
}
|
||||||
|
|
||||||
vendErrors := new(strings.Builder)
|
vendErrors := new(strings.Builder)
|
||||||
vendErrorf := func(mod module.Version, format string, args ...interface{}) {
|
vendErrorf := func(mod module.Version, format string, args ...any) {
|
||||||
detail := fmt.Sprintf(format, args...)
|
detail := fmt.Sprintf(format, args...)
|
||||||
if mod.Version == "" {
|
if mod.Version == "" {
|
||||||
fmt.Fprintf(vendErrors, "\n\t%s: %s", mod.Path, detail)
|
fmt.Fprintf(vendErrors, "\n\t%s: %s", mod.Path, detail)
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ func buildList(targets []module.Version, reqs Reqs, upgrade func(module.Version)
|
||||||
for _, target := range targets {
|
for _, target := range targets {
|
||||||
work.Add(target)
|
work.Add(target)
|
||||||
}
|
}
|
||||||
work.Do(10, func(item interface{}) {
|
work.Do(10, func(item any) {
|
||||||
m := item.(module.Version)
|
m := item.(module.Version)
|
||||||
|
|
||||||
var required []module.Version
|
var required []module.Version
|
||||||
|
|
|
||||||
|
|
@ -14,24 +14,24 @@ import (
|
||||||
// Work manages a set of work items to be executed in parallel, at most once each.
|
// Work manages a set of work items to be executed in parallel, at most once each.
|
||||||
// The items in the set must all be valid map keys.
|
// The items in the set must all be valid map keys.
|
||||||
type Work struct {
|
type Work struct {
|
||||||
f func(interface{}) // function to run for each item
|
f func(any) // function to run for each item
|
||||||
running int // total number of runners
|
running int // total number of runners
|
||||||
|
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
added map[interface{}]bool // items added to set
|
added map[any]bool // items added to set
|
||||||
todo []interface{} // items yet to be run
|
todo []any // items yet to be run
|
||||||
wait sync.Cond // wait when todo is empty
|
wait sync.Cond // wait when todo is empty
|
||||||
waiting int // number of runners waiting for todo
|
waiting int // number of runners waiting for todo
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Work) init() {
|
func (w *Work) init() {
|
||||||
if w.added == nil {
|
if w.added == nil {
|
||||||
w.added = make(map[interface{}]bool)
|
w.added = make(map[any]bool)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add adds item to the work set, if it hasn't already been added.
|
// Add adds item to the work set, if it hasn't already been added.
|
||||||
func (w *Work) Add(item interface{}) {
|
func (w *Work) Add(item any) {
|
||||||
w.mu.Lock()
|
w.mu.Lock()
|
||||||
w.init()
|
w.init()
|
||||||
if !w.added[item] {
|
if !w.added[item] {
|
||||||
|
|
@ -51,7 +51,7 @@ func (w *Work) Add(item interface{}) {
|
||||||
// before calling Do (or else Do returns immediately),
|
// before calling Do (or else Do returns immediately),
|
||||||
// but it is allowed for f(item) to add new items to the set.
|
// but it is allowed for f(item) to add new items to the set.
|
||||||
// Do should only be used once on a given Work.
|
// Do should only be used once on a given Work.
|
||||||
func (w *Work) Do(n int, f func(item interface{})) {
|
func (w *Work) Do(n int, f func(item any)) {
|
||||||
if n < 1 {
|
if n < 1 {
|
||||||
panic("par.Work.Do: n < 1")
|
panic("par.Work.Do: n < 1")
|
||||||
}
|
}
|
||||||
|
|
@ -110,13 +110,13 @@ type Cache struct {
|
||||||
type cacheEntry struct {
|
type cacheEntry struct {
|
||||||
done uint32
|
done uint32
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
result interface{}
|
result any
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do calls the function f if and only if Do is being called for the first time with this key.
|
// Do calls the function f if and only if Do is being called for the first time with this key.
|
||||||
// No call to Do with a given key returns until the one call to f returns.
|
// No call to Do with a given key returns until the one call to f returns.
|
||||||
// Do returns the value returned by the one call to f.
|
// Do returns the value returned by the one call to f.
|
||||||
func (c *Cache) Do(key interface{}, f func() interface{}) interface{} {
|
func (c *Cache) Do(key any, f func() any) any {
|
||||||
entryIface, ok := c.m.Load(key)
|
entryIface, ok := c.m.Load(key)
|
||||||
if !ok {
|
if !ok {
|
||||||
entryIface, _ = c.m.LoadOrStore(key, new(cacheEntry))
|
entryIface, _ = c.m.LoadOrStore(key, new(cacheEntry))
|
||||||
|
|
@ -136,7 +136,7 @@ func (c *Cache) Do(key interface{}, f func() interface{}) interface{} {
|
||||||
// Get returns the cached result associated with key.
|
// Get returns the cached result associated with key.
|
||||||
// It returns nil if there is no such result.
|
// It returns nil if there is no such result.
|
||||||
// If the result for key is being computed, Get does not wait for the computation to finish.
|
// If the result for key is being computed, Get does not wait for the computation to finish.
|
||||||
func (c *Cache) Get(key interface{}) interface{} {
|
func (c *Cache) Get(key any) any {
|
||||||
entryIface, ok := c.m.Load(key)
|
entryIface, ok := c.m.Load(key)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -156,7 +156,7 @@ func (c *Cache) Get(key interface{}) interface{} {
|
||||||
// TODO(jayconrod): Delete this after the package cache clearing functions
|
// TODO(jayconrod): Delete this after the package cache clearing functions
|
||||||
// in internal/load have been removed.
|
// in internal/load have been removed.
|
||||||
func (c *Cache) Clear() {
|
func (c *Cache) Clear() {
|
||||||
c.m.Range(func(key, value interface{}) bool {
|
c.m.Range(func(key, value any) bool {
|
||||||
c.m.Delete(key)
|
c.m.Delete(key)
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
@ -169,7 +169,7 @@ func (c *Cache) Clear() {
|
||||||
//
|
//
|
||||||
// TODO(jayconrod): Delete this after the package cache clearing functions
|
// TODO(jayconrod): Delete this after the package cache clearing functions
|
||||||
// in internal/load have been removed.
|
// in internal/load have been removed.
|
||||||
func (c *Cache) Delete(key interface{}) {
|
func (c *Cache) Delete(key any) {
|
||||||
c.m.Delete(key)
|
c.m.Delete(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,8 +180,8 @@ func (c *Cache) Delete(key interface{}) {
|
||||||
//
|
//
|
||||||
// TODO(jayconrod): Delete this after the package cache clearing functions
|
// TODO(jayconrod): Delete this after the package cache clearing functions
|
||||||
// in internal/load have been removed.
|
// in internal/load have been removed.
|
||||||
func (c *Cache) DeleteIf(pred func(key interface{}) bool) {
|
func (c *Cache) DeleteIf(pred func(key any) bool) {
|
||||||
c.m.Range(func(key, _ interface{}) bool {
|
c.m.Range(func(key, _ any) bool {
|
||||||
if pred(key) {
|
if pred(key) {
|
||||||
c.Delete(key)
|
c.Delete(key)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ func TestWork(t *testing.T) {
|
||||||
const N = 10000
|
const N = 10000
|
||||||
n := int32(0)
|
n := int32(0)
|
||||||
w.Add(N)
|
w.Add(N)
|
||||||
w.Do(100, func(x interface{}) {
|
w.Do(100, func(x any) {
|
||||||
atomic.AddInt32(&n, 1)
|
atomic.AddInt32(&n, 1)
|
||||||
i := x.(int)
|
i := x.(int)
|
||||||
if i >= 2 {
|
if i >= 2 {
|
||||||
|
|
@ -40,7 +40,7 @@ func TestWorkParallel(t *testing.T) {
|
||||||
}
|
}
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
var n int32
|
var n int32
|
||||||
w.Do(N, func(x interface{}) {
|
w.Do(N, func(x any) {
|
||||||
time.Sleep(1 * time.Millisecond)
|
time.Sleep(1 * time.Millisecond)
|
||||||
atomic.AddInt32(&n, +1)
|
atomic.AddInt32(&n, +1)
|
||||||
})
|
})
|
||||||
|
|
@ -58,19 +58,19 @@ func TestCache(t *testing.T) {
|
||||||
var cache Cache
|
var cache Cache
|
||||||
|
|
||||||
n := 1
|
n := 1
|
||||||
v := cache.Do(1, func() interface{} { n++; return n })
|
v := cache.Do(1, func() any { n++; return n })
|
||||||
if v != 2 {
|
if v != 2 {
|
||||||
t.Fatalf("cache.Do(1) did not run f")
|
t.Fatalf("cache.Do(1) did not run f")
|
||||||
}
|
}
|
||||||
v = cache.Do(1, func() interface{} { n++; return n })
|
v = cache.Do(1, func() any { n++; return n })
|
||||||
if v != 2 {
|
if v != 2 {
|
||||||
t.Fatalf("cache.Do(1) ran f again!")
|
t.Fatalf("cache.Do(1) ran f again!")
|
||||||
}
|
}
|
||||||
v = cache.Do(2, func() interface{} { n++; return n })
|
v = cache.Do(2, func() any { n++; return n })
|
||||||
if v != 3 {
|
if v != 3 {
|
||||||
t.Fatalf("cache.Do(2) did not run f")
|
t.Fatalf("cache.Do(2) did not run f")
|
||||||
}
|
}
|
||||||
v = cache.Do(1, func() interface{} { n++; return n })
|
v = cache.Do(1, func() any { n++; return n })
|
||||||
if v != 2 {
|
if v != 2 {
|
||||||
t.Fatalf("cache.Do(1) did not returned saved value from original cache.Do(1)")
|
t.Fatalf("cache.Do(1) did not returned saved value from original cache.Do(1)")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ func init() {
|
||||||
CmdRun.Flag.Var((*base.StringsFlag)(&work.ExecCmd), "exec", "")
|
CmdRun.Flag.Var((*base.StringsFlag)(&work.ExecCmd), "exec", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func printStderr(args ...interface{}) (int, error) {
|
func printStderr(args ...any) (int, error) {
|
||||||
return fmt.Fprint(os.Stderr, args...)
|
return fmt.Fprint(os.Stderr, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
// StringList flattens its arguments into a single []string.
|
// StringList flattens its arguments into a single []string.
|
||||||
// Each argument in args must have type string or []string.
|
// Each argument in args must have type string or []string.
|
||||||
func StringList(args ...interface{}) []string {
|
func StringList(args ...any) []string {
|
||||||
var x []string
|
var x []string
|
||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
switch arg := arg.(type) {
|
switch arg := arg.(type) {
|
||||||
|
|
|
||||||
|
|
@ -1311,7 +1311,7 @@ func metaImportsForPrefix(importPrefix string, mod ModuleMode, security web.Secu
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
resi, _, _ := fetchGroup.Do(importPrefix, func() (resi interface{}, err error) {
|
resi, _, _ := fetchGroup.Do(importPrefix, func() (resi any, err error) {
|
||||||
fetchCacheMu.Lock()
|
fetchCacheMu.Lock()
|
||||||
if res, ok := fetchCache[importPrefix]; ok {
|
if res, ok := fetchCache[importPrefix]; ok {
|
||||||
fetchCacheMu.Unlock()
|
fetchCacheMu.Unlock()
|
||||||
|
|
@ -1588,7 +1588,7 @@ type importError struct {
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
|
||||||
func importErrorf(path, format string, args ...interface{}) error {
|
func importErrorf(path, format string, args ...any) error {
|
||||||
err := &importError{importPath: path, err: fmt.Errorf(format, args...)}
|
err := &importError{importPath: path, err: fmt.Errorf(format, args...)}
|
||||||
if errStr := err.Error(); !strings.Contains(errStr, path) {
|
if errStr := err.Error(); !strings.Contains(errStr, path) {
|
||||||
panic(fmt.Sprintf("path %q not in error %q", path, errStr))
|
panic(fmt.Sprintf("path %q not in error %q", path, errStr))
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ type Builder struct {
|
||||||
actionCache map[cacheKey]*Action // a cache of already-constructed actions
|
actionCache map[cacheKey]*Action // a cache of already-constructed actions
|
||||||
mkdirCache map[string]bool // a cache of created directories
|
mkdirCache map[string]bool // a cache of created directories
|
||||||
flagCache map[[2]string]bool // a cache of supported compiler flags
|
flagCache map[[2]string]bool // a cache of supported compiler flags
|
||||||
Print func(args ...interface{}) (int, error)
|
Print func(args ...any) (int, error)
|
||||||
|
|
||||||
IsCmdList bool // running as part of go list; set p.Stale and additional fields below
|
IsCmdList bool // running as part of go list; set p.Stale and additional fields below
|
||||||
NeedError bool // list needs p.Error
|
NeedError bool // list needs p.Error
|
||||||
|
|
@ -120,8 +120,8 @@ type actionQueue []*Action
|
||||||
func (q *actionQueue) Len() int { return len(*q) }
|
func (q *actionQueue) Len() int { return len(*q) }
|
||||||
func (q *actionQueue) Swap(i, j int) { (*q)[i], (*q)[j] = (*q)[j], (*q)[i] }
|
func (q *actionQueue) Swap(i, j int) { (*q)[i], (*q)[j] = (*q)[j], (*q)[i] }
|
||||||
func (q *actionQueue) Less(i, j int) bool { return (*q)[i].priority < (*q)[j].priority }
|
func (q *actionQueue) Less(i, j int) bool { return (*q)[i].priority < (*q)[j].priority }
|
||||||
func (q *actionQueue) Push(x interface{}) { *q = append(*q, x.(*Action)) }
|
func (q *actionQueue) Push(x any) { *q = append(*q, x.(*Action)) }
|
||||||
func (q *actionQueue) Pop() interface{} {
|
func (q *actionQueue) Pop() any {
|
||||||
n := len(*q) - 1
|
n := len(*q) - 1
|
||||||
x := (*q)[n]
|
x := (*q)[n]
|
||||||
*q = (*q)[:n]
|
*q = (*q)[:n]
|
||||||
|
|
@ -241,7 +241,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (b *Builder) Init() {
|
func (b *Builder) Init() {
|
||||||
b.Print = func(a ...interface{}) (int, error) {
|
b.Print = func(a ...any) (int, error) {
|
||||||
return fmt.Fprint(os.Stderr, a...)
|
return fmt.Fprint(os.Stderr, a...)
|
||||||
}
|
}
|
||||||
b.actionCache = make(map[cacheKey]*Action)
|
b.actionCache = make(map[cacheKey]*Action)
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ func TestRespectSetgidDir(t *testing.T) {
|
||||||
// of `(*Builder).ShowCmd` afterwards as a sanity check.
|
// of `(*Builder).ShowCmd` afterwards as a sanity check.
|
||||||
cfg.BuildX = true
|
cfg.BuildX = true
|
||||||
var cmdBuf bytes.Buffer
|
var cmdBuf bytes.Buffer
|
||||||
b.Print = func(a ...interface{}) (int, error) {
|
b.Print = func(a ...any) (int, error) {
|
||||||
return cmdBuf.WriteString(fmt.Sprint(a...))
|
return cmdBuf.WriteString(fmt.Sprint(a...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1948,7 +1948,7 @@ func mayberemovefile(s string) {
|
||||||
// fmtcmd replaces the name of the current directory with dot (.)
|
// fmtcmd replaces the name of the current directory with dot (.)
|
||||||
// but only when it is at the beginning of a space-separated token.
|
// but only when it is at the beginning of a space-separated token.
|
||||||
//
|
//
|
||||||
func (b *Builder) fmtcmd(dir string, format string, args ...interface{}) string {
|
func (b *Builder) fmtcmd(dir string, format string, args ...any) string {
|
||||||
cmd := fmt.Sprintf(format, args...)
|
cmd := fmt.Sprintf(format, args...)
|
||||||
if dir != "" && dir != "/" {
|
if dir != "" && dir != "/" {
|
||||||
dot := " ."
|
dot := " ."
|
||||||
|
|
@ -1974,7 +1974,7 @@ func (b *Builder) fmtcmd(dir string, format string, args ...interface{}) string
|
||||||
|
|
||||||
// showcmd prints the given command to standard output
|
// showcmd prints the given command to standard output
|
||||||
// for the implementation of -n or -x.
|
// for the implementation of -n or -x.
|
||||||
func (b *Builder) Showcmd(dir string, format string, args ...interface{}) {
|
func (b *Builder) Showcmd(dir string, format string, args ...any) {
|
||||||
b.output.Lock()
|
b.output.Lock()
|
||||||
defer b.output.Unlock()
|
defer b.output.Unlock()
|
||||||
b.Print(b.fmtcmd(dir, format, args...) + "\n")
|
b.Print(b.fmtcmd(dir, format, args...) + "\n")
|
||||||
|
|
@ -2038,7 +2038,7 @@ var cgoTypeSigRe = lazyregexp.New(`\b_C2?(type|func|var|macro)_\B`)
|
||||||
// run runs the command given by cmdline in the directory dir.
|
// run runs the command given by cmdline in the directory dir.
|
||||||
// If the command fails, run prints information about the failure
|
// If the command fails, run prints information about the failure
|
||||||
// and returns a non-nil error.
|
// and returns a non-nil error.
|
||||||
func (b *Builder) run(a *Action, dir string, desc string, env []string, cmdargs ...interface{}) error {
|
func (b *Builder) run(a *Action, dir string, desc string, env []string, cmdargs ...any) error {
|
||||||
out, err := b.runOut(a, dir, env, cmdargs...)
|
out, err := b.runOut(a, dir, env, cmdargs...)
|
||||||
if len(out) > 0 {
|
if len(out) > 0 {
|
||||||
if desc == "" {
|
if desc == "" {
|
||||||
|
|
@ -2072,7 +2072,7 @@ func (b *Builder) processOutput(out []byte) string {
|
||||||
// runOut runs the command given by cmdline in the directory dir.
|
// runOut runs the command given by cmdline in the directory dir.
|
||||||
// It returns the command output and any errors that occurred.
|
// It returns the command output and any errors that occurred.
|
||||||
// It accumulates execution time in a.
|
// It accumulates execution time in a.
|
||||||
func (b *Builder) runOut(a *Action, dir string, env []string, cmdargs ...interface{}) ([]byte, error) {
|
func (b *Builder) runOut(a *Action, dir string, env []string, cmdargs ...any) ([]byte, error) {
|
||||||
cmdline := str.StringList(cmdargs...)
|
cmdline := str.StringList(cmdargs...)
|
||||||
|
|
||||||
for _, arg := range cmdline {
|
for _, arg := range cmdline {
|
||||||
|
|
@ -2409,7 +2409,7 @@ func (b *Builder) gccld(a *Action, p *load.Package, objdir, outfile string, flag
|
||||||
cmd = b.GccCmd(p.Dir, objdir)
|
cmd = b.GccCmd(p.Dir, objdir)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdargs := []interface{}{cmd, "-o", outfile, objs, flags}
|
cmdargs := []any{cmd, "-o", outfile, objs, flags}
|
||||||
dir := p.Dir
|
dir := p.Dir
|
||||||
out, err := b.runOut(a, base.Cwd(), b.cCompilerEnv(), cmdargs...)
|
out, err := b.runOut(a, base.Cwd(), b.cCompilerEnv(), cmdargs...)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ func (gcToolchain) gc(b *Builder, a *Action, archive string, importcfg, embedcfg
|
||||||
gcflags = append(gcflags, fmt.Sprintf("-c=%d", c))
|
gcflags = append(gcflags, fmt.Sprintf("-c=%d", c))
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []interface{}{cfg.BuildToolexec, base.Tool("compile"), "-o", ofile, "-trimpath", a.trimpath(), defaultGcFlags, gcflags}
|
args := []any{cfg.BuildToolexec, base.Tool("compile"), "-o", ofile, "-trimpath", a.trimpath(), defaultGcFlags, gcflags}
|
||||||
if p.Internal.LocalPrefix == "" {
|
if p.Internal.LocalPrefix == "" {
|
||||||
args = append(args, "-nolocalimports")
|
args = append(args, "-nolocalimports")
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -362,11 +362,11 @@ func (a *Action) trimpath() string {
|
||||||
return rewrite
|
return rewrite
|
||||||
}
|
}
|
||||||
|
|
||||||
func asmArgs(a *Action, p *load.Package) []interface{} {
|
func asmArgs(a *Action, p *load.Package) []any {
|
||||||
// Add -I pkg/GOOS_GOARCH so #include "textflag.h" works in .s files.
|
// Add -I pkg/GOOS_GOARCH so #include "textflag.h" works in .s files.
|
||||||
inc := filepath.Join(cfg.GOROOT, "pkg", "include")
|
inc := filepath.Join(cfg.GOROOT, "pkg", "include")
|
||||||
pkgpath := pkgPath(a)
|
pkgpath := pkgPath(a)
|
||||||
args := []interface{}{cfg.BuildToolexec, base.Tool("asm"), "-p", pkgpath, "-trimpath", a.trimpath(), "-I", a.Objdir, "-I", inc, "-D", "GOOS_" + cfg.Goos, "-D", "GOARCH_" + cfg.Goarch, forcedAsmflags, p.Internal.Asmflags}
|
args := []any{cfg.BuildToolexec, base.Tool("asm"), "-p", pkgpath, "-trimpath", a.trimpath(), "-I", a.Objdir, "-I", inc, "-D", "GOOS_" + cfg.Goos, "-D", "GOARCH_" + cfg.Goarch, forcedAsmflags, p.Internal.Asmflags}
|
||||||
if p.ImportPath == "runtime" && cfg.Goarch == "386" {
|
if p.ImportPath == "runtime" && cfg.Goarch == "386" {
|
||||||
for _, arg := range forcedAsmflags {
|
for _, arg := range forcedAsmflags {
|
||||||
if arg == "-dynlink" {
|
if arg == "-dynlink" {
|
||||||
|
|
@ -455,8 +455,8 @@ func (gcToolchain) symabis(b *Builder, a *Action, sfiles []string) (string, erro
|
||||||
// toolVerify checks that the command line args writes the same output file
|
// toolVerify checks that the command line args writes the same output file
|
||||||
// if run using newTool instead.
|
// if run using newTool instead.
|
||||||
// Unused now but kept around for future use.
|
// Unused now but kept around for future use.
|
||||||
func toolVerify(a *Action, b *Builder, p *load.Package, newTool string, ofile string, args []interface{}) error {
|
func toolVerify(a *Action, b *Builder, p *load.Package, newTool string, ofile string, args []any) error {
|
||||||
newArgs := make([]interface{}, len(args))
|
newArgs := make([]any, len(args))
|
||||||
copy(newArgs, args)
|
copy(newArgs, args)
|
||||||
newArgs[1] = base.Tool(newTool)
|
newArgs[1] = base.Tool(newTool)
|
||||||
newArgs[3] = ofile + ".new" // x.6 becomes x.6.new
|
newArgs[3] = ofile + ".new" // x.6 becomes x.6.new
|
||||||
|
|
|
||||||
|
|
@ -357,7 +357,7 @@ func proxyHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
zip []byte
|
zip []byte
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
c := zipCache.Do(a, func() interface{} {
|
c := zipCache.Do(a, func() any {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
z := zip.NewWriter(&buf)
|
z := zip.NewWriter(&buf)
|
||||||
for _, f := range a.Files {
|
for _, f := range a.Files {
|
||||||
|
|
@ -431,7 +431,7 @@ func readArchive(path, vers string) (*txtar.Archive, error) {
|
||||||
|
|
||||||
prefix := strings.ReplaceAll(enc, "/", "_")
|
prefix := strings.ReplaceAll(enc, "/", "_")
|
||||||
name := filepath.Join(cmdGoDir, "testdata/mod", prefix+"_"+encVers+".txt")
|
name := filepath.Join(cmdGoDir, "testdata/mod", prefix+"_"+encVers+".txt")
|
||||||
a := archiveCache.Do(name, func() interface{} {
|
a := archiveCache.Do(name, func() any {
|
||||||
a, err := txtar.ParseFile(name)
|
a, err := txtar.ParseFile(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if testing.Verbose() || !os.IsNotExist(err) {
|
if testing.Verbose() || !os.IsNotExist(err) {
|
||||||
|
|
|
||||||
|
|
@ -375,7 +375,7 @@ Script:
|
||||||
default:
|
default:
|
||||||
if strings.HasPrefix(cond.tag, "exec:") {
|
if strings.HasPrefix(cond.tag, "exec:") {
|
||||||
prog := cond.tag[len("exec:"):]
|
prog := cond.tag[len("exec:"):]
|
||||||
ok = execCache.Do(prog, func() interface{} {
|
ok = execCache.Do(prog, func() any {
|
||||||
if runtime.GOOS == "plan9" && prog == "git" {
|
if runtime.GOOS == "plan9" && prog == "git" {
|
||||||
// The Git command is usually not the real Git on Plan 9.
|
// The Git command is usually not the real Git on Plan 9.
|
||||||
// See https://golang.org/issues/29640.
|
// See https://golang.org/issues/29640.
|
||||||
|
|
@ -1310,7 +1310,7 @@ func (ts *testScript) expand(s string, inRegexp bool) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// fatalf aborts the test with the given failure message.
|
// fatalf aborts the test with the given failure message.
|
||||||
func (ts *testScript) fatalf(format string, args ...interface{}) {
|
func (ts *testScript) fatalf(format string, args ...any) {
|
||||||
fmt.Fprintf(&ts.log, "FAIL: %s:%d: %s\n", ts.file, ts.lineno, fmt.Sprintf(format, args...))
|
fmt.Fprintf(&ts.log, "FAIL: %s:%d: %s\n", ts.file, ts.lineno, fmt.Sprintf(format, args...))
|
||||||
ts.t.FailNow()
|
ts.t.FailNow()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// Addmod adds a module as a txtar archive to the testdata/mod directory.
|
// Addmod adds a module as a txtar archive to the testdata/mod directory.
|
||||||
|
|
@ -39,7 +40,7 @@ func usage() {
|
||||||
|
|
||||||
var tmpdir string
|
var tmpdir string
|
||||||
|
|
||||||
func fatalf(format string, args ...interface{}) {
|
func fatalf(format string, args ...any) {
|
||||||
os.RemoveAll(tmpdir)
|
os.RemoveAll(tmpdir)
|
||||||
log.Fatalf(format, args...)
|
log.Fatalf(format, args...)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// Savedir archives a directory tree as a txtar archive printed to standard output.
|
// Savedir archives a directory tree as a txtar archive printed to standard output.
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build linux
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
// This test is run by src/cmd/dist/test.go (cmd_go_test_terminal),
|
// This test is run by src/cmd/dist/test.go (cmd_go_test_terminal),
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ func (r *reporter) getState() *reporterState {
|
||||||
|
|
||||||
// Warnf emits a warning message to the reporter's error stream,
|
// Warnf emits a warning message to the reporter's error stream,
|
||||||
// without changing its exit code.
|
// without changing its exit code.
|
||||||
func (r *reporter) Warnf(format string, args ...interface{}) {
|
func (r *reporter) Warnf(format string, args ...any) {
|
||||||
fmt.Fprintf(r.getState().err, format, args...)
|
fmt.Fprintf(r.getState().err, format, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ func TestFindAndHash(t *testing.T) {
|
||||||
id[i] = byte(i)
|
id[i] = byte(i)
|
||||||
}
|
}
|
||||||
numError := 0
|
numError := 0
|
||||||
errorf := func(msg string, args ...interface{}) {
|
errorf := func(msg string, args ...any) {
|
||||||
t.Errorf(msg, args...)
|
t.Errorf(msg, args...)
|
||||||
if numError++; numError > 20 {
|
if numError++; numError > 20 {
|
||||||
t.Logf("stopping after too many errors")
|
t.Logf("stopping after too many errors")
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ func (r *excludedReader) Read(p []byte) (int, error) {
|
||||||
return n, err
|
return n, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func findMachoCodeSignature(r interface{}) (*macho.File, codesign.CodeSigCmd, bool) {
|
func findMachoCodeSignature(r any) (*macho.File, codesign.CodeSigCmd, bool) {
|
||||||
ra, ok := r.(io.ReaderAt)
|
ra, ok := r.(io.ReaderAt)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, codesign.CodeSigCmd{}, false
|
return nil, codesign.CodeSigCmd{}, false
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ func writeAndKill(w io.Writer, b []byte) {
|
||||||
// and fails the test with a useful message if they don't match.
|
// and fails the test with a useful message if they don't match.
|
||||||
func diffJSON(t *testing.T, have, want []byte) {
|
func diffJSON(t *testing.T, have, want []byte) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
type event map[string]interface{}
|
type event map[string]any
|
||||||
|
|
||||||
// Parse into events, one per line.
|
// Parse into events, one per line.
|
||||||
parseEvents := func(b []byte) ([]event, []string) {
|
parseEvents := func(b []byte) ([]event, []string) {
|
||||||
|
|
|
||||||
|
|
@ -16,20 +16,20 @@ type Data struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Event struct {
|
type Event struct {
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Phase string `json:"ph"`
|
Phase string `json:"ph"`
|
||||||
Scope string `json:"s,omitempty"`
|
Scope string `json:"s,omitempty"`
|
||||||
Time float64 `json:"ts"`
|
Time float64 `json:"ts"`
|
||||||
Dur float64 `json:"dur,omitempty"`
|
Dur float64 `json:"dur,omitempty"`
|
||||||
PID uint64 `json:"pid"`
|
PID uint64 `json:"pid"`
|
||||||
TID uint64 `json:"tid"`
|
TID uint64 `json:"tid"`
|
||||||
ID uint64 `json:"id,omitempty"`
|
ID uint64 `json:"id,omitempty"`
|
||||||
BindPoint string `json:"bp,omitempty"`
|
BindPoint string `json:"bp,omitempty"`
|
||||||
Stack int `json:"sf,omitempty"`
|
Stack int `json:"sf,omitempty"`
|
||||||
EndStack int `json:"esf,omitempty"`
|
EndStack int `json:"esf,omitempty"`
|
||||||
Arg interface{} `json:"args,omitempty"`
|
Arg any `json:"args,omitempty"`
|
||||||
Cname string `json:"cname,omitempty"`
|
Cname string `json:"cname,omitempty"`
|
||||||
Category string `json:"cat,omitempty"`
|
Category string `json:"cat,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Frame struct {
|
type Frame struct {
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ func main() {
|
||||||
|
|
||||||
var exitCode = 0
|
var exitCode = 0
|
||||||
|
|
||||||
func errorf(format string, args ...interface{}) {
|
func errorf(format string, args ...any) {
|
||||||
log.Printf(format, args...)
|
log.Printf(format, args...)
|
||||||
exitCode = 1
|
exitCode = 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ func TestLargeDefs(t *testing.T) {
|
||||||
}
|
}
|
||||||
b := bufio.NewWriter(f)
|
b := bufio.NewWriter(f)
|
||||||
|
|
||||||
printf := func(format string, args ...interface{}) {
|
printf := func(format string, args ...any) {
|
||||||
_, err := fmt.Fprintf(b, format, args...)
|
_, err := fmt.Fprintf(b, format, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Writing to %s: %v", large, err)
|
t.Fatalf("Writing to %s: %v", large, err)
|
||||||
|
|
@ -454,7 +454,7 @@ func (f *FakeFile) IsDir() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FakeFile) Sys() interface{} {
|
func (f *FakeFile) Sys() any {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,18 +69,18 @@ func (r *readlineUI) ReadLine(prompt string) (string, error) {
|
||||||
// It formats the text as fmt.Print would and adds a final \n if not already present.
|
// It formats the text as fmt.Print would and adds a final \n if not already present.
|
||||||
// For line-based UI, Print writes to standard error.
|
// For line-based UI, Print writes to standard error.
|
||||||
// (Standard output is reserved for report data.)
|
// (Standard output is reserved for report data.)
|
||||||
func (r *readlineUI) Print(args ...interface{}) {
|
func (r *readlineUI) Print(args ...any) {
|
||||||
r.print(false, args...)
|
r.print(false, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrintErr shows an error message to the user.
|
// PrintErr shows an error message to the user.
|
||||||
// It formats the text as fmt.Print would and adds a final \n if not already present.
|
// It formats the text as fmt.Print would and adds a final \n if not already present.
|
||||||
// For line-based UI, PrintErr writes to standard error.
|
// For line-based UI, PrintErr writes to standard error.
|
||||||
func (r *readlineUI) PrintErr(args ...interface{}) {
|
func (r *readlineUI) PrintErr(args ...any) {
|
||||||
r.print(true, args...)
|
r.print(true, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *readlineUI) print(withColor bool, args ...interface{}) {
|
func (r *readlineUI) print(withColor bool, args ...any) {
|
||||||
text := fmt.Sprint(args...)
|
text := fmt.Sprint(args...)
|
||||||
if !strings.HasSuffix(text, "\n") {
|
if !strings.HasSuffix(text, "\n") {
|
||||||
text += "\n"
|
text += "\n"
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ var templMain = template.Must(template.New("").Parse(`
|
||||||
</html>
|
</html>
|
||||||
`))
|
`))
|
||||||
|
|
||||||
func dief(msg string, args ...interface{}) {
|
func dief(msg string, args ...any) {
|
||||||
fmt.Fprintf(os.Stderr, msg, args...)
|
fmt.Fprintf(os.Stderr, msg, args...)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ func httpMMUPlot(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create JSON response.
|
// Create JSON response.
|
||||||
err = json.NewEncoder(w).Encode(map[string]interface{}{"xMin": int64(xMin), "xMax": int64(xMax), "quantiles": quantiles, "curve": plot})
|
err = json.NewEncoder(w).Encode(map[string]any{"xMin": int64(xMin), "xMax": int64(xMax), "quantiles": quantiles, "curve": plot})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("failed to serialize response: %v", err)
|
log.Printf("failed to serialize response: %v", err)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -1054,7 +1054,7 @@ func (ctx *traceContext) emitInstant(ev *trace.Event, name, category string) {
|
||||||
cname = colorLightGrey
|
cname = colorLightGrey
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var arg interface{}
|
var arg any
|
||||||
if ev.Type == trace.EvProcStart {
|
if ev.Type == trace.EvProcStart {
|
||||||
type Arg struct {
|
type Arg struct {
|
||||||
ThreadID uint64
|
ThreadID uint64
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,13 @@ func (h IntHeap) Len() int { return len(h) }
|
||||||
func (h IntHeap) Less(i, j int) bool { return h[i] < h[j] }
|
func (h IntHeap) Less(i, j int) bool { return h[i] < h[j] }
|
||||||
func (h IntHeap) Swap(i, j int) { h[i], h[j] = h[j], h[i] }
|
func (h IntHeap) Swap(i, j int) { h[i], h[j] = h[j], h[i] }
|
||||||
|
|
||||||
func (h *IntHeap) Push(x interface{}) {
|
func (h *IntHeap) Push(x any) {
|
||||||
// Push and Pop use pointer receivers because they modify the slice's length,
|
// Push and Pop use pointer receivers because they modify the slice's length,
|
||||||
// not just its contents.
|
// not just its contents.
|
||||||
*h = append(*h, x.(int))
|
*h = append(*h, x.(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *IntHeap) Pop() interface{} {
|
func (h *IntHeap) Pop() any {
|
||||||
old := *h
|
old := *h
|
||||||
n := len(old)
|
n := len(old)
|
||||||
x := old[n-1]
|
x := old[n-1]
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,14 @@ func (pq PriorityQueue) Swap(i, j int) {
|
||||||
pq[j].index = j
|
pq[j].index = j
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pq *PriorityQueue) Push(x interface{}) {
|
func (pq *PriorityQueue) Push(x any) {
|
||||||
n := len(*pq)
|
n := len(*pq)
|
||||||
item := x.(*Item)
|
item := x.(*Item)
|
||||||
item.index = n
|
item.index = n
|
||||||
*pq = append(*pq, item)
|
*pq = append(*pq, item)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pq *PriorityQueue) Pop() interface{} {
|
func (pq *PriorityQueue) Pop() any {
|
||||||
old := *pq
|
old := *pq
|
||||||
n := len(old)
|
n := len(old)
|
||||||
item := old[n-1]
|
item := old[n-1]
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ import "sort"
|
||||||
// use heap.Push and heap.Pop.
|
// use heap.Push and heap.Pop.
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
sort.Interface
|
sort.Interface
|
||||||
Push(x interface{}) // add x as element Len()
|
Push(x any) // add x as element Len()
|
||||||
Pop() interface{} // remove and return element Len() - 1.
|
Pop() any // remove and return element Len() - 1.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init establishes the heap invariants required by the other routines in this package.
|
// Init establishes the heap invariants required by the other routines in this package.
|
||||||
|
|
@ -49,7 +49,7 @@ func Init(h Interface) {
|
||||||
|
|
||||||
// Push pushes the element x onto the heap.
|
// Push pushes the element x onto the heap.
|
||||||
// The complexity is O(log n) where n = h.Len().
|
// The complexity is O(log n) where n = h.Len().
|
||||||
func Push(h Interface, x interface{}) {
|
func Push(h Interface, x any) {
|
||||||
h.Push(x)
|
h.Push(x)
|
||||||
up(h, h.Len()-1)
|
up(h, h.Len()-1)
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +57,7 @@ func Push(h Interface, x interface{}) {
|
||||||
// Pop removes and returns the minimum element (according to Less) from the heap.
|
// Pop removes and returns the minimum element (according to Less) from the heap.
|
||||||
// The complexity is O(log n) where n = h.Len().
|
// The complexity is O(log n) where n = h.Len().
|
||||||
// Pop is equivalent to Remove(h, 0).
|
// Pop is equivalent to Remove(h, 0).
|
||||||
func Pop(h Interface) interface{} {
|
func Pop(h Interface) any {
|
||||||
n := h.Len() - 1
|
n := h.Len() - 1
|
||||||
h.Swap(0, n)
|
h.Swap(0, n)
|
||||||
down(h, 0, n)
|
down(h, 0, n)
|
||||||
|
|
@ -66,7 +66,7 @@ func Pop(h Interface) interface{} {
|
||||||
|
|
||||||
// Remove removes and returns the element at index i from the heap.
|
// Remove removes and returns the element at index i from the heap.
|
||||||
// The complexity is O(log n) where n = h.Len().
|
// The complexity is O(log n) where n = h.Len().
|
||||||
func Remove(h Interface, i int) interface{} {
|
func Remove(h Interface, i int) any {
|
||||||
n := h.Len() - 1
|
n := h.Len() - 1
|
||||||
if n != i {
|
if n != i {
|
||||||
h.Swap(i, n)
|
h.Swap(i, n)
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@ func (h *myHeap) Len() int {
|
||||||
return len(*h)
|
return len(*h)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *myHeap) Pop() (v interface{}) {
|
func (h *myHeap) Pop() (v any) {
|
||||||
*h, v = (*h)[:h.Len()-1], (*h)[h.Len()-1]
|
*h, v = (*h)[:h.Len()-1], (*h)[h.Len()-1]
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *myHeap) Push(v interface{}) {
|
func (h *myHeap) Push(v any) {
|
||||||
*h = append(*h, v.(int))
|
*h = append(*h, v.(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ type Element struct {
|
||||||
list *List
|
list *List
|
||||||
|
|
||||||
// The value stored with this element.
|
// The value stored with this element.
|
||||||
Value interface{}
|
Value any
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next returns the next list element or nil.
|
// Next returns the next list element or nil.
|
||||||
|
|
@ -100,7 +100,7 @@ func (l *List) insert(e, at *Element) *Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
// insertValue is a convenience wrapper for insert(&Element{Value: v}, at).
|
// insertValue is a convenience wrapper for insert(&Element{Value: v}, at).
|
||||||
func (l *List) insertValue(v interface{}, at *Element) *Element {
|
func (l *List) insertValue(v any, at *Element) *Element {
|
||||||
return l.insert(&Element{Value: v}, at)
|
return l.insert(&Element{Value: v}, at)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ func (l *List) move(e, at *Element) {
|
||||||
// Remove removes e from l if e is an element of list l.
|
// Remove removes e from l if e is an element of list l.
|
||||||
// It returns the element value e.Value.
|
// It returns the element value e.Value.
|
||||||
// The element must not be nil.
|
// The element must not be nil.
|
||||||
func (l *List) Remove(e *Element) interface{} {
|
func (l *List) Remove(e *Element) any {
|
||||||
if e.list == l {
|
if e.list == l {
|
||||||
// if e.list == l, l must have been initialized when e was inserted
|
// if e.list == l, l must have been initialized when e was inserted
|
||||||
// in l or l == nil (e is a zero Element) and l.remove will crash
|
// in l or l == nil (e is a zero Element) and l.remove will crash
|
||||||
|
|
@ -141,13 +141,13 @@ func (l *List) Remove(e *Element) interface{} {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PushFront inserts a new element e with value v at the front of list l and returns e.
|
// PushFront inserts a new element e with value v at the front of list l and returns e.
|
||||||
func (l *List) PushFront(v interface{}) *Element {
|
func (l *List) PushFront(v any) *Element {
|
||||||
l.lazyInit()
|
l.lazyInit()
|
||||||
return l.insertValue(v, &l.root)
|
return l.insertValue(v, &l.root)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PushBack inserts a new element e with value v at the back of list l and returns e.
|
// PushBack inserts a new element e with value v at the back of list l and returns e.
|
||||||
func (l *List) PushBack(v interface{}) *Element {
|
func (l *List) PushBack(v any) *Element {
|
||||||
l.lazyInit()
|
l.lazyInit()
|
||||||
return l.insertValue(v, l.root.prev)
|
return l.insertValue(v, l.root.prev)
|
||||||
}
|
}
|
||||||
|
|
@ -155,7 +155,7 @@ func (l *List) PushBack(v interface{}) *Element {
|
||||||
// InsertBefore inserts a new element e with value v immediately before mark and returns e.
|
// InsertBefore inserts a new element e with value v immediately before mark and returns e.
|
||||||
// If mark is not an element of l, the list is not modified.
|
// If mark is not an element of l, the list is not modified.
|
||||||
// The mark must not be nil.
|
// The mark must not be nil.
|
||||||
func (l *List) InsertBefore(v interface{}, mark *Element) *Element {
|
func (l *List) InsertBefore(v any, mark *Element) *Element {
|
||||||
if mark.list != l {
|
if mark.list != l {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -166,7 +166,7 @@ func (l *List) InsertBefore(v interface{}, mark *Element) *Element {
|
||||||
// InsertAfter inserts a new element e with value v immediately after mark and returns e.
|
// InsertAfter inserts a new element e with value v immediately after mark and returns e.
|
||||||
// If mark is not an element of l, the list is not modified.
|
// If mark is not an element of l, the list is not modified.
|
||||||
// The mark must not be nil.
|
// The mark must not be nil.
|
||||||
func (l *List) InsertAfter(v interface{}, mark *Element) *Element {
|
func (l *List) InsertAfter(v any, mark *Element) *Element {
|
||||||
if mark.list != l {
|
if mark.list != l {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ func TestList(t *testing.T) {
|
||||||
checkListPointers(t, l, []*Element{})
|
checkListPointers(t, l, []*Element{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkList(t *testing.T, l *List, es []interface{}) {
|
func checkList(t *testing.T, l *List, es []any) {
|
||||||
if !checkListLen(t, l, len(es)) {
|
if !checkListLen(t, l, len(es)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -169,36 +169,36 @@ func TestExtending(t *testing.T) {
|
||||||
|
|
||||||
l3 := New()
|
l3 := New()
|
||||||
l3.PushBackList(l1)
|
l3.PushBackList(l1)
|
||||||
checkList(t, l3, []interface{}{1, 2, 3})
|
checkList(t, l3, []any{1, 2, 3})
|
||||||
l3.PushBackList(l2)
|
l3.PushBackList(l2)
|
||||||
checkList(t, l3, []interface{}{1, 2, 3, 4, 5})
|
checkList(t, l3, []any{1, 2, 3, 4, 5})
|
||||||
|
|
||||||
l3 = New()
|
l3 = New()
|
||||||
l3.PushFrontList(l2)
|
l3.PushFrontList(l2)
|
||||||
checkList(t, l3, []interface{}{4, 5})
|
checkList(t, l3, []any{4, 5})
|
||||||
l3.PushFrontList(l1)
|
l3.PushFrontList(l1)
|
||||||
checkList(t, l3, []interface{}{1, 2, 3, 4, 5})
|
checkList(t, l3, []any{1, 2, 3, 4, 5})
|
||||||
|
|
||||||
checkList(t, l1, []interface{}{1, 2, 3})
|
checkList(t, l1, []any{1, 2, 3})
|
||||||
checkList(t, l2, []interface{}{4, 5})
|
checkList(t, l2, []any{4, 5})
|
||||||
|
|
||||||
l3 = New()
|
l3 = New()
|
||||||
l3.PushBackList(l1)
|
l3.PushBackList(l1)
|
||||||
checkList(t, l3, []interface{}{1, 2, 3})
|
checkList(t, l3, []any{1, 2, 3})
|
||||||
l3.PushBackList(l3)
|
l3.PushBackList(l3)
|
||||||
checkList(t, l3, []interface{}{1, 2, 3, 1, 2, 3})
|
checkList(t, l3, []any{1, 2, 3, 1, 2, 3})
|
||||||
|
|
||||||
l3 = New()
|
l3 = New()
|
||||||
l3.PushFrontList(l1)
|
l3.PushFrontList(l1)
|
||||||
checkList(t, l3, []interface{}{1, 2, 3})
|
checkList(t, l3, []any{1, 2, 3})
|
||||||
l3.PushFrontList(l3)
|
l3.PushFrontList(l3)
|
||||||
checkList(t, l3, []interface{}{1, 2, 3, 1, 2, 3})
|
checkList(t, l3, []any{1, 2, 3, 1, 2, 3})
|
||||||
|
|
||||||
l3 = New()
|
l3 = New()
|
||||||
l1.PushBackList(l3)
|
l1.PushBackList(l3)
|
||||||
checkList(t, l1, []interface{}{1, 2, 3})
|
checkList(t, l1, []any{1, 2, 3})
|
||||||
l1.PushFrontList(l3)
|
l1.PushFrontList(l3)
|
||||||
checkList(t, l1, []interface{}{1, 2, 3})
|
checkList(t, l1, []any{1, 2, 3})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRemove(t *testing.T) {
|
func TestRemove(t *testing.T) {
|
||||||
|
|
@ -289,19 +289,19 @@ func TestMove(t *testing.T) {
|
||||||
func TestZeroList(t *testing.T) {
|
func TestZeroList(t *testing.T) {
|
||||||
var l1 = new(List)
|
var l1 = new(List)
|
||||||
l1.PushFront(1)
|
l1.PushFront(1)
|
||||||
checkList(t, l1, []interface{}{1})
|
checkList(t, l1, []any{1})
|
||||||
|
|
||||||
var l2 = new(List)
|
var l2 = new(List)
|
||||||
l2.PushBack(1)
|
l2.PushBack(1)
|
||||||
checkList(t, l2, []interface{}{1})
|
checkList(t, l2, []any{1})
|
||||||
|
|
||||||
var l3 = new(List)
|
var l3 = new(List)
|
||||||
l3.PushFrontList(l1)
|
l3.PushFrontList(l1)
|
||||||
checkList(t, l3, []interface{}{1})
|
checkList(t, l3, []any{1})
|
||||||
|
|
||||||
var l4 = new(List)
|
var l4 = new(List)
|
||||||
l4.PushBackList(l2)
|
l4.PushBackList(l2)
|
||||||
checkList(t, l4, []interface{}{1})
|
checkList(t, l4, []any{1})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that a list l is not modified when calling InsertBefore with a mark that is not an element of l.
|
// Test that a list l is not modified when calling InsertBefore with a mark that is not an element of l.
|
||||||
|
|
@ -311,7 +311,7 @@ func TestInsertBeforeUnknownMark(t *testing.T) {
|
||||||
l.PushBack(2)
|
l.PushBack(2)
|
||||||
l.PushBack(3)
|
l.PushBack(3)
|
||||||
l.InsertBefore(1, new(Element))
|
l.InsertBefore(1, new(Element))
|
||||||
checkList(t, &l, []interface{}{1, 2, 3})
|
checkList(t, &l, []any{1, 2, 3})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that a list l is not modified when calling InsertAfter with a mark that is not an element of l.
|
// Test that a list l is not modified when calling InsertAfter with a mark that is not an element of l.
|
||||||
|
|
@ -321,7 +321,7 @@ func TestInsertAfterUnknownMark(t *testing.T) {
|
||||||
l.PushBack(2)
|
l.PushBack(2)
|
||||||
l.PushBack(3)
|
l.PushBack(3)
|
||||||
l.InsertAfter(1, new(Element))
|
l.InsertAfter(1, new(Element))
|
||||||
checkList(t, &l, []interface{}{1, 2, 3})
|
checkList(t, &l, []any{1, 2, 3})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that a list l is not modified when calling MoveAfter or MoveBefore with a mark that is not an element of l.
|
// Test that a list l is not modified when calling MoveAfter or MoveBefore with a mark that is not an element of l.
|
||||||
|
|
@ -333,10 +333,10 @@ func TestMoveUnknownMark(t *testing.T) {
|
||||||
e2 := l2.PushBack(2)
|
e2 := l2.PushBack(2)
|
||||||
|
|
||||||
l1.MoveAfter(e1, e2)
|
l1.MoveAfter(e1, e2)
|
||||||
checkList(t, &l1, []interface{}{1})
|
checkList(t, &l1, []any{1})
|
||||||
checkList(t, &l2, []interface{}{2})
|
checkList(t, &l2, []any{2})
|
||||||
|
|
||||||
l1.MoveBefore(e1, e2)
|
l1.MoveBefore(e1, e2)
|
||||||
checkList(t, &l1, []interface{}{1})
|
checkList(t, &l1, []any{1})
|
||||||
checkList(t, &l2, []interface{}{2})
|
checkList(t, &l2, []any{2})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ func ExampleRing_Do() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterate through the ring and print its contents
|
// Iterate through the ring and print its contents
|
||||||
r.Do(func(p interface{}) {
|
r.Do(func(p any) {
|
||||||
fmt.Println(p.(int))
|
fmt.Println(p.(int))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -117,7 +117,7 @@ func ExampleRing_Move() {
|
||||||
r = r.Move(3)
|
r = r.Move(3)
|
||||||
|
|
||||||
// Iterate through the ring and print its contents
|
// Iterate through the ring and print its contents
|
||||||
r.Do(func(p interface{}) {
|
r.Do(func(p any) {
|
||||||
fmt.Println(p.(int))
|
fmt.Println(p.(int))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -154,7 +154,7 @@ func ExampleRing_Link() {
|
||||||
rs := r.Link(s)
|
rs := r.Link(s)
|
||||||
|
|
||||||
// Iterate through the combined ring and print its contents
|
// Iterate through the combined ring and print its contents
|
||||||
rs.Do(func(p interface{}) {
|
rs.Do(func(p any) {
|
||||||
fmt.Println(p.(int))
|
fmt.Println(p.(int))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -182,7 +182,7 @@ func ExampleRing_Unlink() {
|
||||||
r.Unlink(3)
|
r.Unlink(3)
|
||||||
|
|
||||||
// Iterate through the remaining ring and print its contents
|
// Iterate through the remaining ring and print its contents
|
||||||
r.Do(func(p interface{}) {
|
r.Do(func(p any) {
|
||||||
fmt.Println(p.(int))
|
fmt.Println(p.(int))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ package ring
|
||||||
//
|
//
|
||||||
type Ring struct {
|
type Ring struct {
|
||||||
next, prev *Ring
|
next, prev *Ring
|
||||||
Value interface{} // for use by client; untouched by this library
|
Value any // for use by client; untouched by this library
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Ring) init() *Ring {
|
func (r *Ring) init() *Ring {
|
||||||
|
|
@ -131,7 +131,7 @@ func (r *Ring) Len() int {
|
||||||
|
|
||||||
// Do calls function f on each element of the ring, in forward order.
|
// Do calls function f on each element of the ring, in forward order.
|
||||||
// The behavior of Do is undefined if f changes *r.
|
// The behavior of Do is undefined if f changes *r.
|
||||||
func (r *Ring) Do(f func(interface{})) {
|
func (r *Ring) Do(f func(any)) {
|
||||||
if r != nil {
|
if r != nil {
|
||||||
f(r.Value)
|
f(r.Value)
|
||||||
for p := r.Next(); p != r; p = p.next {
|
for p := r.Next(); p != r; p = p.next {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ func verify(t *testing.T, r *Ring, N int, sum int) {
|
||||||
// iteration
|
// iteration
|
||||||
n = 0
|
n = 0
|
||||||
s := 0
|
s := 0
|
||||||
r.Do(func(p interface{}) {
|
r.Do(func(p any) {
|
||||||
n++
|
n++
|
||||||
if p != nil {
|
if p != nil {
|
||||||
s += p.(int)
|
s += p.(int)
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ type Context interface {
|
||||||
// u, ok := ctx.Value(userKey).(*User)
|
// u, ok := ctx.Value(userKey).(*User)
|
||||||
// return u, ok
|
// return u, ok
|
||||||
// }
|
// }
|
||||||
Value(key interface{}) interface{}
|
Value(key any) any
|
||||||
}
|
}
|
||||||
|
|
||||||
// Canceled is the error returned by Context.Err when the context is canceled.
|
// Canceled is the error returned by Context.Err when the context is canceled.
|
||||||
|
|
@ -182,7 +182,7 @@ func (*emptyCtx) Err() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*emptyCtx) Value(key interface{}) interface{} {
|
func (*emptyCtx) Value(key any) any {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -348,7 +348,7 @@ type cancelCtx struct {
|
||||||
err error // set to non-nil by the first cancel call
|
err error // set to non-nil by the first cancel call
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cancelCtx) Value(key interface{}) interface{} {
|
func (c *cancelCtx) Value(key any) any {
|
||||||
if key == &cancelCtxKey {
|
if key == &cancelCtxKey {
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
@ -520,7 +520,7 @@ func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) {
|
||||||
// interface{}, context keys often have concrete type
|
// interface{}, context keys often have concrete type
|
||||||
// struct{}. Alternatively, exported context key variables' static
|
// struct{}. Alternatively, exported context key variables' static
|
||||||
// type should be a pointer or interface.
|
// type should be a pointer or interface.
|
||||||
func WithValue(parent Context, key, val interface{}) Context {
|
func WithValue(parent Context, key, val any) Context {
|
||||||
if parent == nil {
|
if parent == nil {
|
||||||
panic("cannot create context from nil parent")
|
panic("cannot create context from nil parent")
|
||||||
}
|
}
|
||||||
|
|
@ -537,13 +537,13 @@ func WithValue(parent Context, key, val interface{}) Context {
|
||||||
// delegates all other calls to the embedded Context.
|
// delegates all other calls to the embedded Context.
|
||||||
type valueCtx struct {
|
type valueCtx struct {
|
||||||
Context
|
Context
|
||||||
key, val interface{}
|
key, val any
|
||||||
}
|
}
|
||||||
|
|
||||||
// stringify tries a bit to stringify v, without using fmt, since we don't
|
// stringify tries a bit to stringify v, without using fmt, since we don't
|
||||||
// want context depending on the unicode tables. This is only used by
|
// want context depending on the unicode tables. This is only used by
|
||||||
// *valueCtx.String().
|
// *valueCtx.String().
|
||||||
func stringify(v interface{}) string {
|
func stringify(v any) string {
|
||||||
switch s := v.(type) {
|
switch s := v.(type) {
|
||||||
case stringer:
|
case stringer:
|
||||||
return s.String()
|
return s.String()
|
||||||
|
|
@ -559,14 +559,14 @@ func (c *valueCtx) String() string {
|
||||||
", val " + stringify(c.val) + ")"
|
", val " + stringify(c.val) + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *valueCtx) Value(key interface{}) interface{} {
|
func (c *valueCtx) Value(key any) any {
|
||||||
if c.key == key {
|
if c.key == key {
|
||||||
return c.val
|
return c.val
|
||||||
}
|
}
|
||||||
return value(c.Context, key)
|
return value(c.Context, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
func value(c Context, key interface{}) interface{} {
|
func value(c Context, key any) any {
|
||||||
for {
|
for {
|
||||||
switch ctx := c.(type) {
|
switch ctx := c.(type) {
|
||||||
case *valueCtx:
|
case *valueCtx:
|
||||||
|
|
|
||||||
|
|
@ -16,21 +16,21 @@ import (
|
||||||
|
|
||||||
type testingT interface {
|
type testingT interface {
|
||||||
Deadline() (time.Time, bool)
|
Deadline() (time.Time, bool)
|
||||||
Error(args ...interface{})
|
Error(args ...any)
|
||||||
Errorf(format string, args ...interface{})
|
Errorf(format string, args ...any)
|
||||||
Fail()
|
Fail()
|
||||||
FailNow()
|
FailNow()
|
||||||
Failed() bool
|
Failed() bool
|
||||||
Fatal(args ...interface{})
|
Fatal(args ...any)
|
||||||
Fatalf(format string, args ...interface{})
|
Fatalf(format string, args ...any)
|
||||||
Helper()
|
Helper()
|
||||||
Log(args ...interface{})
|
Log(args ...any)
|
||||||
Logf(format string, args ...interface{})
|
Logf(format string, args ...any)
|
||||||
Name() string
|
Name() string
|
||||||
Parallel()
|
Parallel()
|
||||||
Skip(args ...interface{})
|
Skip(args ...any)
|
||||||
SkipNow()
|
SkipNow()
|
||||||
Skipf(format string, args ...interface{})
|
Skipf(format string, args ...any)
|
||||||
Skipped() bool
|
Skipped() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -553,7 +553,7 @@ func testLayers(t testingT, seed int64, testTimeout bool) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
r := rand.New(rand.NewSource(seed))
|
r := rand.New(rand.NewSource(seed))
|
||||||
errorf := func(format string, a ...interface{}) {
|
errorf := func(format string, a ...any) {
|
||||||
t.Errorf(fmt.Sprintf("seed=%d: %s", seed, format), a...)
|
t.Errorf(fmt.Sprintf("seed=%d: %s", seed, format), a...)
|
||||||
}
|
}
|
||||||
const (
|
const (
|
||||||
|
|
@ -691,7 +691,7 @@ func XTestInvalidDerivedFail(t testingT) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func recoveredValue(fn func()) (v interface{}) {
|
func recoveredValue(fn func()) (v any) {
|
||||||
defer func() { v = recover() }()
|
defer func() { v = recover() }()
|
||||||
fn()
|
fn()
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ func RegisterHash(h Hash, f func() hash.Hash) {
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// which can be used for increased type safety within applications.
|
// which can be used for increased type safety within applications.
|
||||||
type PublicKey interface{}
|
type PublicKey any
|
||||||
|
|
||||||
// PrivateKey represents a private key using an unspecified algorithm.
|
// PrivateKey represents a private key using an unspecified algorithm.
|
||||||
//
|
//
|
||||||
|
|
@ -173,7 +173,7 @@ type PublicKey interface{}
|
||||||
//
|
//
|
||||||
// as well as purpose-specific interfaces such as Signer and Decrypter, which
|
// as well as purpose-specific interfaces such as Signer and Decrypter, which
|
||||||
// can be used for increased type safety within applications.
|
// can be used for increased type safety within applications.
|
||||||
type PrivateKey interface{}
|
type PrivateKey any
|
||||||
|
|
||||||
// Signer is an interface for an opaque private key that can be used for
|
// Signer is an interface for an opaque private key that can be used for
|
||||||
// signing operations. For example, an RSA key kept in a hardware module.
|
// signing operations. For example, an RSA key kept in a hardware module.
|
||||||
|
|
@ -220,4 +220,4 @@ type Decrypter interface {
|
||||||
Decrypt(rand io.Reader, msg []byte, opts DecrypterOpts) (plaintext []byte, err error)
|
Decrypt(rand io.Reader, msg []byte, opts DecrypterOpts) (plaintext []byte, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type DecrypterOpts interface{}
|
type DecrypterOpts any
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ func TestScalarAliasing(t *testing.T) {
|
||||||
return x == x1 && y == y1
|
return x == x1 && y == y1
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, f := range map[string]interface{}{
|
for name, f := range map[string]any{
|
||||||
"Negate": func(v, x Scalar) bool {
|
"Negate": func(v, x Scalar) bool {
|
||||||
return checkAliasingOneArg((*Scalar).Negate, v, x)
|
return checkAliasingOneArg((*Scalar).Negate, v, x)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ type cipherSuite struct {
|
||||||
ka func(version uint16) keyAgreement
|
ka func(version uint16) keyAgreement
|
||||||
// flags is a bitmask of the suite* values, above.
|
// flags is a bitmask of the suite* values, above.
|
||||||
flags int
|
flags int
|
||||||
cipher func(key, iv []byte, isRead bool) interface{}
|
cipher func(key, iv []byte, isRead bool) any
|
||||||
mac func(key []byte) hash.Hash
|
mac func(key []byte) hash.Hash
|
||||||
aead func(key, fixedNonce []byte) aead
|
aead func(key, fixedNonce []byte) aead
|
||||||
}
|
}
|
||||||
|
|
@ -399,12 +399,12 @@ func aesgcmPreferred(ciphers []uint16) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func cipherRC4(key, iv []byte, isRead bool) interface{} {
|
func cipherRC4(key, iv []byte, isRead bool) any {
|
||||||
cipher, _ := rc4.NewCipher(key)
|
cipher, _ := rc4.NewCipher(key)
|
||||||
return cipher
|
return cipher
|
||||||
}
|
}
|
||||||
|
|
||||||
func cipher3DES(key, iv []byte, isRead bool) interface{} {
|
func cipher3DES(key, iv []byte, isRead bool) any {
|
||||||
block, _ := des.NewTripleDESCipher(key)
|
block, _ := des.NewTripleDESCipher(key)
|
||||||
if isRead {
|
if isRead {
|
||||||
return cipher.NewCBCDecrypter(block, iv)
|
return cipher.NewCBCDecrypter(block, iv)
|
||||||
|
|
@ -412,7 +412,7 @@ func cipher3DES(key, iv []byte, isRead bool) interface{} {
|
||||||
return cipher.NewCBCEncrypter(block, iv)
|
return cipher.NewCBCEncrypter(block, iv)
|
||||||
}
|
}
|
||||||
|
|
||||||
func cipherAES(key, iv []byte, isRead bool) interface{} {
|
func cipherAES(key, iv []byte, isRead bool) any {
|
||||||
block, _ := aes.NewCipher(key)
|
block, _ := aes.NewCipher(key)
|
||||||
if isRead {
|
if isRead {
|
||||||
return cipher.NewCBCDecrypter(block, iv)
|
return cipher.NewCBCDecrypter(block, iv)
|
||||||
|
|
|
||||||
|
|
@ -1466,7 +1466,7 @@ func defaultConfig() *Config {
|
||||||
return &emptyConfig
|
return &emptyConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func unexpectedMessageError(wanted, got interface{}) error {
|
func unexpectedMessageError(wanted, got any) error {
|
||||||
return fmt.Errorf("tls: received unexpected handshake message of type %T when waiting for %T", got, wanted)
|
return fmt.Errorf("tls: received unexpected handshake message of type %T when waiting for %T", got, wanted)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,16 +163,16 @@ func (c *Conn) NetConn() net.Conn {
|
||||||
type halfConn struct {
|
type halfConn struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
|
|
||||||
err error // first permanent error
|
err error // first permanent error
|
||||||
version uint16 // protocol version
|
version uint16 // protocol version
|
||||||
cipher interface{} // cipher algorithm
|
cipher any // cipher algorithm
|
||||||
mac hash.Hash
|
mac hash.Hash
|
||||||
seq [8]byte // 64-bit sequence number
|
seq [8]byte // 64-bit sequence number
|
||||||
|
|
||||||
scratchBuf [13]byte // to avoid allocs; interface method args escape
|
scratchBuf [13]byte // to avoid allocs; interface method args escape
|
||||||
|
|
||||||
nextCipher interface{} // next encryption state
|
nextCipher any // next encryption state
|
||||||
nextMac hash.Hash // next MAC algorithm
|
nextMac hash.Hash // next MAC algorithm
|
||||||
|
|
||||||
trafficSecret []byte // current TLS 1.3 traffic secret
|
trafficSecret []byte // current TLS 1.3 traffic secret
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +197,7 @@ func (hc *halfConn) setErrorLocked(err error) error {
|
||||||
|
|
||||||
// prepareCipherSpec sets the encryption and MAC states
|
// prepareCipherSpec sets the encryption and MAC states
|
||||||
// that a subsequent changeCipherSpec will use.
|
// that a subsequent changeCipherSpec will use.
|
||||||
func (hc *halfConn) prepareCipherSpec(version uint16, cipher interface{}, mac hash.Hash) {
|
func (hc *halfConn) prepareCipherSpec(version uint16, cipher any, mac hash.Hash) {
|
||||||
hc.version = version
|
hc.version = version
|
||||||
hc.nextCipher = cipher
|
hc.nextCipher = cipher
|
||||||
hc.nextMac = mac
|
hc.nextMac = mac
|
||||||
|
|
@ -935,7 +935,7 @@ func (c *Conn) flush() (int, error) {
|
||||||
|
|
||||||
// outBufPool pools the record-sized scratch buffers used by writeRecordLocked.
|
// outBufPool pools the record-sized scratch buffers used by writeRecordLocked.
|
||||||
var outBufPool = sync.Pool{
|
var outBufPool = sync.Pool{
|
||||||
New: func() interface{} {
|
New: func() any {
|
||||||
return new([]byte)
|
return new([]byte)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -1011,7 +1011,7 @@ func (c *Conn) writeRecord(typ recordType, data []byte) (int, error) {
|
||||||
|
|
||||||
// readHandshake reads the next handshake message from
|
// readHandshake reads the next handshake message from
|
||||||
// the record layer.
|
// the record layer.
|
||||||
func (c *Conn) readHandshake() (interface{}, error) {
|
func (c *Conn) readHandshake() (any, error) {
|
||||||
for c.hand.Len() < 4 {
|
for c.hand.Len() < 4 {
|
||||||
if err := c.readRecord(); err != nil {
|
if err := c.readRecord(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ var (
|
||||||
ed25519Key = flag.Bool("ed25519", false, "Generate an Ed25519 key")
|
ed25519Key = flag.Bool("ed25519", false, "Generate an Ed25519 key")
|
||||||
)
|
)
|
||||||
|
|
||||||
func publicKey(priv interface{}) interface{} {
|
func publicKey(priv any) any {
|
||||||
switch k := priv.(type) {
|
switch k := priv.(type) {
|
||||||
case *rsa.PrivateKey:
|
case *rsa.PrivateKey:
|
||||||
return &k.PublicKey
|
return &k.PublicKey
|
||||||
|
|
@ -57,7 +57,7 @@ func main() {
|
||||||
log.Fatalf("Missing required --host parameter")
|
log.Fatalf("Missing required --host parameter")
|
||||||
}
|
}
|
||||||
|
|
||||||
var priv interface{}
|
var priv any
|
||||||
var err error
|
var err error
|
||||||
switch *ecdsaCurve {
|
switch *ecdsaCurve {
|
||||||
case "":
|
case "":
|
||||||
|
|
|
||||||
|
|
@ -657,7 +657,7 @@ func (hs *clientHandshakeState) establishKeys() error {
|
||||||
|
|
||||||
clientMAC, serverMAC, clientKey, serverKey, clientIV, serverIV :=
|
clientMAC, serverMAC, clientKey, serverKey, clientIV, serverIV :=
|
||||||
keysFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.hello.random, hs.serverHello.random, hs.suite.macLen, hs.suite.keyLen, hs.suite.ivLen)
|
keysFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.hello.random, hs.serverHello.random, hs.suite.macLen, hs.suite.keyLen, hs.suite.ivLen)
|
||||||
var clientCipher, serverCipher interface{}
|
var clientCipher, serverCipher any
|
||||||
var clientHash, serverHash hash.Hash
|
var clientHash, serverHash hash.Hash
|
||||||
if hs.suite.cipher != nil {
|
if hs.suite.cipher != nil {
|
||||||
clientCipher = hs.suite.cipher(clientKey, clientIV, false /* not for reading */)
|
clientCipher = hs.suite.cipher(clientKey, clientIV, false /* not for reading */)
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ type clientTest struct {
|
||||||
cert []byte
|
cert []byte
|
||||||
// key, if not nil, contains either a *rsa.PrivateKey, ed25519.PrivateKey or
|
// key, if not nil, contains either a *rsa.PrivateKey, ed25519.PrivateKey or
|
||||||
// *ecdsa.PrivateKey which is the private key for the reference server.
|
// *ecdsa.PrivateKey which is the private key for the reference server.
|
||||||
key interface{}
|
key any
|
||||||
// extensions, if not nil, contains a list of extension data to be returned
|
// extensions, if not nil, contains a list of extension data to be returned
|
||||||
// from the ServerHello. The data should be in standard TLS format with
|
// from the ServerHello. The data should be in standard TLS format with
|
||||||
// a 2-byte uint16 type, 2-byte data length, followed by the extension data.
|
// a 2-byte uint16 type, 2-byte data length, followed by the extension data.
|
||||||
|
|
@ -171,7 +171,7 @@ func (test *clientTest) connFromCommand() (conn *recordingConn, child *exec.Cmd,
|
||||||
certPath := tempFile(string(cert))
|
certPath := tempFile(string(cert))
|
||||||
defer os.Remove(certPath)
|
defer os.Remove(certPath)
|
||||||
|
|
||||||
var key interface{} = testRSAPrivateKey
|
var key any = testRSAPrivateKey
|
||||||
if test.key != nil {
|
if test.key != nil {
|
||||||
key = test.key
|
key = test.key
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var tests = []interface{}{
|
var tests = []any{
|
||||||
&clientHelloMsg{},
|
&clientHelloMsg{},
|
||||||
&serverHelloMsg{},
|
&serverHelloMsg{},
|
||||||
&finishedMsg{},
|
&finishedMsg{},
|
||||||
|
|
|
||||||
|
|
@ -681,7 +681,7 @@ func (hs *serverHandshakeState) establishKeys() error {
|
||||||
clientMAC, serverMAC, clientKey, serverKey, clientIV, serverIV :=
|
clientMAC, serverMAC, clientKey, serverKey, clientIV, serverIV :=
|
||||||
keysFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.clientHello.random, hs.hello.random, hs.suite.macLen, hs.suite.keyLen, hs.suite.ivLen)
|
keysFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.clientHello.random, hs.hello.random, hs.suite.macLen, hs.suite.keyLen, hs.suite.ivLen)
|
||||||
|
|
||||||
var clientCipher, serverCipher interface{}
|
var clientCipher, serverCipher any
|
||||||
var clientHash, serverHash hash.Hash
|
var clientHash, serverHash hash.Hash
|
||||||
|
|
||||||
if hs.suite.aead == nil {
|
if hs.suite.aead == nil {
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ func TestTLS12OnlyCipherSuites(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
c, s := localPipe(t)
|
c, s := localPipe(t)
|
||||||
replyChan := make(chan interface{})
|
replyChan := make(chan any)
|
||||||
go func() {
|
go func() {
|
||||||
cli := Client(c, testConfig)
|
cli := Client(c, testConfig)
|
||||||
cli.vers = clientHello.vers
|
cli.vers = clientHello.vers
|
||||||
|
|
@ -304,7 +304,7 @@ func TestTLSPointFormats(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
c, s := localPipe(t)
|
c, s := localPipe(t)
|
||||||
replyChan := make(chan interface{})
|
replyChan := make(chan any)
|
||||||
go func() {
|
go func() {
|
||||||
cli := Client(c, testConfig)
|
cli := Client(c, testConfig)
|
||||||
cli.vers = clientHello.vers
|
cli.vers = clientHello.vers
|
||||||
|
|
@ -600,7 +600,7 @@ func (test *serverTest) connFromCommand() (conn *recordingConn, child *exec.Cmd,
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
connChan := make(chan interface{}, 1)
|
connChan := make(chan any, 1)
|
||||||
go func() {
|
go func() {
|
||||||
tcpConn, err := l.Accept()
|
tcpConn, err := l.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue