Skip to content

testing: iterators break t.Helper() #72794

@mrwonko

Description

@mrwonko

Go version

go version go1.24.1 darwin/amd64

Output of go env in your module/workspace:

AR='ar'
CC='cc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='c++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/willi/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/willi/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/m7/j4gfn87j6tbbjqkjkllgjvg40000gn/T/go-build3215631796=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/willi/<redacted>/go.mod'
GOMODCACHE='/Users/willi/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/willi/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/Cellar/go/1.24.1/libexec'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/willi/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/Cellar/go/1.24.1/libexec/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.24.1'
GOWORK='/Users/willi/<redacted>/go.work'
PKG_CONFIG='pkg-config'

What did you do?

package repro

import (
	"strings"
	"testing"
)

func TestHelper(t *testing.T) {
	helper(t)
}

func helper(t *testing.T) {
	t.Helper()
	// t.Fatal("this correctly displays repro_test.go:9 as its origin")
	for range strings.SplitSeq("a,b,c", ",") {
		t.Fatal("this incorrectly shows repro_test.go:16 (this line) as its origin, ignoring t.Helper()")
	}
}

What did you see happen?

repro_test.go:16: this incorrectly shows repro_test.go:16 (this line) as its origin, ignoring t.Helper()

What did you expect to see?

repro_test.go:9: this incorrectly shows repro_test.go:16 (this line) as its origin, ignoring t.Helper()

Metadata

Metadata

Assignees

Labels

FixPendingIssues that have a fix which has not yet been reviewed or submitted.NeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions