aboutsummaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2025-10-14 11:40:26 +0200
committerGopher Robot <gobot@golang.org>2025-10-17 13:10:27 -0700
commitb5aefe07e5afe2fd5d49c6a4219cc826b3e4e34e (patch)
tree3b3576e22ccc48d21f106c65d3bd10f368aaabf6 /src/reflect
parent5137c473b64cb157380eb6deb1b60bf6780402b3 (diff)
downloadgo-b5aefe07e5afe2fd5d49c6a4219cc826b3e4e34e.tar.xz
all: remove unnecessary loop variable copies in tests
Copying the loop variable is no longer necessary since Go 1.22. Change-Id: Iebb21dac44a20ec200567f1d786f105a4ee4999d Reviewed-on: https://go-review.googlesource.com/c/go/+/711640 Reviewed-by: Florian Lehner <lehner.florian86@gmail.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Damien Neil <dneil@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/all_test.go3
-rw-r--r--src/reflect/visiblefields_test.go1
2 files changed, 0 insertions, 4 deletions
diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go
index c6610b1968..1fa850a275 100644
--- a/src/reflect/all_test.go
+++ b/src/reflect/all_test.go
@@ -7515,7 +7515,6 @@ func TestTypeStrings(t *testing.T) {
func TestOffsetLock(t *testing.T) {
var wg sync.WaitGroup
for i := 0; i < 4; i++ {
- i := i
wg.Add(1)
go func() {
for j := 0; j < 50; j++ {
@@ -8535,7 +8534,6 @@ func TestClear(t *testing.T) {
}
for _, tc := range tests {
- tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
if !tc.testFunc(tc.value) {
@@ -8569,7 +8567,6 @@ func TestValuePointerAndUnsafePointer(t *testing.T) {
}
for _, tc := range tests {
- tc := tc
t.Run(tc.name, func(t *testing.T) {
if got := tc.val.Pointer(); got != uintptr(tc.wantUnsafePointer) {
t.Errorf("unexpected uintptr result, got %#x, want %#x", got, uintptr(tc.wantUnsafePointer))
diff --git a/src/reflect/visiblefields_test.go b/src/reflect/visiblefields_test.go
index 66d545dd1f..eca0925f96 100644
--- a/src/reflect/visiblefields_test.go
+++ b/src/reflect/visiblefields_test.go
@@ -292,7 +292,6 @@ type Rec2 struct {
func TestFields(t *testing.T) {
for _, test := range fieldsTests {
- test := test
t.Run(test.testName, func(t *testing.T) {
typ := TypeOf(test.val)
fields := VisibleFields(typ)