all: gofmt -w -r 'interface{} -> any' src · golang/go@2580d0e

4 min read Original article ↗

File tree

445 files changed

lines changed

      • compile/internal/importer

      • ed25519/internal/edwards25519

445 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -538,7 +538,7 @@ type headerFileInfo struct {

538538

func (fi headerFileInfo) Size() int64 { return fi.h.Size }

539539

func (fi headerFileInfo) IsDir() bool { return fi.Mode().IsDir() }

540540

func (fi headerFileInfo) ModTime() time.Time { return fi.h.ModTime }

541-

func (fi headerFileInfo) Sys() interface{} { return fi.h }

541+

func (fi headerFileInfo) Sys() any { return fi.h }

542542
543543

// Name returns the base name of the file.

544544

func (fi headerFileInfo) Name() string {

Original file line numberDiff line numberDiff line change

@@ -1363,7 +1363,7 @@ func TestFileReader(t *testing.T) {

13631363

wantLCnt int64

13641364

wantPCnt int64

13651365

}

1366-

testFnc interface{} // testRead | testWriteTo | testRemaining

1366+

testFnc any // testRead | testWriteTo | testRemaining

13671367

)

13681368
13691369

type (

@@ -1376,7 +1376,7 @@ func TestFileReader(t *testing.T) {

13761376

spd sparseDatas

13771377

size int64

13781378

}

1379-

fileMaker interface{} // makeReg | makeSparse

1379+

fileMaker any // makeReg | makeSparse

13801380

)

13811381
13821382

vectors := []struct {

Original file line numberDiff line numberDiff line change

@@ -23,7 +23,7 @@ import (

2323
2424

type testError struct{ error }

2525
26-

type fileOps []interface{} // []T where T is (string | int64)

26+

type fileOps []any // []T where T is (string | int64)

2727
2828

// testFile is an io.ReadWriteSeeker where the IO operations performed

2929

// on it must match the list of operations in ops.

Original file line numberDiff line numberDiff line change

@@ -67,7 +67,7 @@ func TestWriter(t *testing.T) {

6767

testClose struct { // Close() == wantErr

6868

wantErr error

6969

}

70-

testFnc interface{} // testHeader | testWrite | testReadFrom | testClose

70+

testFnc any // testHeader | testWrite | testReadFrom | testClose

7171

)

7272
7373

vectors := []struct {

@@ -1031,7 +1031,7 @@ func TestFileWriter(t *testing.T) {

10311031

wantLCnt int64

10321032

wantPCnt int64

10331033

}

1034-

testFnc interface{} // testWrite | testReadFrom | testRemaining

1034+

testFnc any // testWrite | testReadFrom | testRemaining

10351035

)

10361036
10371037

type (

@@ -1044,7 +1044,7 @@ func TestFileWriter(t *testing.T) {

10441044

sph sparseHoles

10451045

size int64

10461046

}

1047-

fileMaker interface{} // makeReg | makeSparse

1047+

fileMaker any // makeReg | makeSparse

10481048

)

10491049
10501050

vectors := []struct {

Original file line numberDiff line numberDiff line change

@@ -670,7 +670,7 @@ func (f *fileListEntry) Size() int64 { return 0 }

670670

func (f *fileListEntry) Mode() fs.FileMode { return fs.ModeDir | 0555 }

671671

func (f *fileListEntry) Type() fs.FileMode { return fs.ModeDir }

672672

func (f *fileListEntry) IsDir() bool { return true }

673-

func (f *fileListEntry) Sys() interface{} { return nil }

673+

func (f *fileListEntry) Sys() any { return nil }

674674
675675

func (f *fileListEntry) ModTime() time.Time {

676676

if f.file == nil {

Original file line numberDiff line numberDiff line change

@@ -163,7 +163,7 @@ func (fi headerFileInfo) ModTime() time.Time {

163163

}

164164

func (fi headerFileInfo) Mode() fs.FileMode { return fi.fh.Mode() }

165165

func (fi headerFileInfo) Type() fs.FileMode { return fi.fh.Mode().Type() }

166-

func (fi headerFileInfo) Sys() interface{} { return fi.fh }

166+

func (fi headerFileInfo) Sys() any { return fi.fh }

167167
168168

func (fi headerFileInfo) Info() (fs.FileInfo, error) { return fi, nil }

169169
Original file line numberDiff line numberDiff line change

@@ -239,7 +239,7 @@ func close(c chan<- Type)

239239

// that point, the program is terminated with a non-zero exit code. This

240240

// termination sequence is called panicking and can be controlled by the

241241

// built-in function recover.

242-

func panic(v interface{})

242+

func panic(v any)

243243
244244

// The recover built-in function allows a program to manage behavior of a

245245

// panicking goroutine. Executing a call to recover inside a deferred

@@ -250,7 +250,7 @@ func panic(v interface{})

250250

// panicking, or if the argument supplied to panic was nil, recover returns

251251

// nil. Thus the return value from recover reports whether the goroutine is

252252

// panicking.

253-

func recover() interface{}

253+

func recover() any

254254
255255

// The print built-in function formats its arguments in an

256256

// implementation-specific way and writes the result to standard error.

Original file line numberDiff line numberDiff line change

@@ -76,7 +76,7 @@ func TestReaderAt(t *testing.T) {

7676

off int64

7777

n int

7878

want string

79-

wanterr interface{}

79+

wanterr any

8080

}{

8181

{0, 10, "0123456789", nil},

8282

{1, 10, "123456789", io.EOF},

Original file line numberDiff line numberDiff line change

@@ -1071,7 +1071,7 @@ func (w *Walker) emitMethod(m *types.Selection) {

10711071

w.emitf("method (%s%s) %s%s", w.typeString(recv), tps, m.Obj().Name(), w.signatureString(sig))

10721072

}

10731073
1074-

func (w *Walker) emitf(format string, args ...interface{}) {

1074+

func (w *Walker) emitf(format string, args ...any) {

10751075

f := strings.Join(w.scope, ", ") + ", " + fmt.Sprintf(format, args...)

10761076

if strings.Contains(f, "\n") {

10771077

panic("feature contains newlines: " + f)

Original file line numberDiff line numberDiff line change

@@ -1,3 +1,4 @@

1+

//go:build !amd64

12

// +build !amd64

23
34

package p