]> Cypherpunks repositories - gostls13.git/commitdiff
all: omit unnecessary reassignment
authorcuishuang <imcusg@gmail.com>
Fri, 10 Oct 2025 03:47:13 +0000 (11:47 +0800)
committerGopher Robot <gobot@golang.org>
Fri, 10 Oct 2025 21:38:27 +0000 (14:38 -0700)
The new version of Go has been optimized, and variables do not need
to be reassigned.

Change-Id: I0374b049271e53510f2b162f6821fb3595f2c8ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/710835
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/encoding/base32/base32_test.go
src/encoding/xml/marshal_test.go
src/io/fs/readdir_test.go
src/testing/iotest/reader_test.go

index f5d3c49e38fbef48781ca87913c35d54672caaa5..6f8d564def3c86f154a02e0d3a0fa4db3185b99d 100644 (file)
@@ -709,7 +709,6 @@ func TestBufferedDecodingPadding(t *testing.T) {
        }
 
        for _, testcase := range testcases {
-               testcase := testcase
                pr, pw := io.Pipe()
                go func() {
                        for _, chunk := range testcase.chunks {
index b8bce7170a60b6f350c7f0dc5fd50f14d570237c..6c7e711aac056658335e8d90d5927da0ebaf0990 100644 (file)
@@ -2561,7 +2561,6 @@ var closeTests = []struct {
 
 func TestClose(t *testing.T) {
        for _, tt := range closeTests {
-               tt := tt
                t.Run(tt.desc, func(t *testing.T) {
                        var out strings.Builder
                        enc := NewEncoder(&out)
index 4c409ae7a010e2cb9c202a2431674de39a235f3a..b89706b893afd2f3f616dc6279889fefb25e7239 100644 (file)
@@ -72,7 +72,6 @@ func TestFileInfoToDirEntry(t *testing.T) {
        }
 
        for _, test := range tests {
-               test := test
                t.Run(test.path, func(t *testing.T) {
                        fi, err := Stat(testFs, test.path)
                        if err != nil {
index 1d222372caf384c9dcbaf12c1350c46feb07cf7c..cecfbfce4920c403f0256f4cb54b61d66fb473df 100644 (file)
@@ -238,7 +238,6 @@ func TestErrReader(t *testing.T) {
        }
 
        for _, tt := range cases {
-               tt := tt
                t.Run(tt.name, func(t *testing.T) {
                        n, err := ErrReader(tt.err).Read(nil)
                        if err != tt.err {