Skip to content

sqlclosecheck|rowserrcheck: panic unreachable #6467

@erane-opti

Description

@erane-opti

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

How did you install golangci-lint?

Official binary

Description of the problem

Both linters calls go/types.Identical(..) which panics with unreachable
It seems (i'm not very sure) that this functions can't handle iter.Seq2

Version of golangci-lint

Details
$ golangci-lint --version
golangci-lint has version 2.11.4 built with go1.26.1 from 8f3b0c7e on 2026-03-22T17:35:14Z

Configuration

Details
golangci-lint run --enable sqlclosecheck --disable errcheck
golangci-lint run --enable rowserrcheck --disable errcheck

Go environment

Details
$ go version && go env
go1.25.8

Verbose output of running

Details
$ golangci-lint cache clean
$ golangci-lint  --enable rowserrcheck --disable errcheck
ERRO [runner] Panic: rowserrcheck: package "main" (isInitialPkg: true, needAnalyzeSource: true): unreachable: goroutine 1365 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:26 +0x5e
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*action).analyzeSafe.func1()
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_action.go:55 +0x257
panic({0x154c5a0?, 0x1b7cd30?})
        runtime/panic.go:860 +0x13a
go/types.(*comparer).identical(0x2d19833ce94e, {0x1b920a8?, 0x29ca010?}, {0x1b901c8?, 0x2d1983467880?}, 0x0)
        go/types/predicates.go:497 +0x805
go/types.(*comparer).identical(0x2d19833ce94e, {0x1b902e0?, 0x29ca000?}, {0x1b902e0?, 0x2d198273ab80?}, 0x0)
        go/types/predicates.go:311 +0x6ff
go/types.Identical(...)
        go/types/api_predicates.go:90
github.com/jingyugao/rowserrcheck/passes/rowserr.(*runner).getCallReturnsRow(0x2d19847e5ac0, {0x1ba2b50?, 0x2d19839a0b00})
        github.com/jingyugao/rowserrcheck@v1.1.1/passes/rowserr/rowserr.go:203 +0xcb
github.com/jingyugao/rowserrcheck/passes/rowserr.(*runner).errCallMissing(0x2d19847e5ac0, 0x1b901c8?, 0x2d1981c7e380?)
        github.com/jingyugao/rowserrcheck@v1.1.1/passes/rowserr/rowserr.go:112 +0x3a
github.com/jingyugao/rowserrcheck/passes/rowserr.runner.run({0x2d19820fe460, 0x2d198273ab80, 0x0, {0x1bb1110, 0x2d19836c3770}, 0x2d1983fae300, {0x2d198273ab70, 0x1, 0x1}}, 0x2d19820fe460, ...)
        github.com/jingyugao/rowserrcheck@v1.1.1/passes/rowserr/rowserr.go:103 +0x37d
github.com/golangci/golangci-lint/v2/pkg/golinters/rowserrcheck.New.NewAnalyzer.NewRun.func1(0x2d19820fe460)
        github.com/jingyugao/rowserrcheck@v1.1.1/passes/rowserr/rowserr.go:44 +0x13e
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*action).analyze.func3(...)
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_checker.go:180
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*action).analyze(0x2d1983391380)
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_checker.go:206 +0xb6b
github.com/golangci/golangci-lint/v2/pkg/timeutils.(*Stopwatch).TrackStage(0x2d19834c2140, {0x1825fb4, 0xc}, 0x2d19832eff10)
        github.com/golangci/golangci-lint/v2/pkg/timeutils/stopwatch.go:111 +0x44
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*action).analyzeSafe(0x2d1983391380?)
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_action.go:59 +0x71
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*loadingPackage).analyze.func2()
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_loadingpackage.go:107 +0x65
golang.org/x/sync/errgroup.(*Group).Go.func1()
        golang.org/x/sync@v0.20.0/errgroup/errgroup.go:93 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 193
        golang.org/x/sync@v0.20.0/errgroup/errgroup.go:78 +0x95 
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: rowserrcheck: package "main" (isInitialPkg: true, needAnalyzeSource: true): unreachable 
ERRO Running error: can't run linter goanalysis_metalinter
goanalysis_metalinter: rowserrcheck: package "main" (isInitialPkg: true, needAnalyzeSource: true): unreachable 
$ golangci-lint cache clean
$ golangci-lint  --enable rowserrcheck --disable errcheck
ERRO [runner] Panic: sqlclosecheck: package "main" (isInitialPkg: true, needAnalyzeSource: true): unreachable: goroutine 1336 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:26 +0x5e
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*action).analyzeSafe.func1()
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_action.go:55 +0x257
panic({0x154c5a0?, 0x1b7cd30?})
        runtime/panic.go:860 +0x13a
go/types.(*comparer).identical(0xddbac7fb9de, {0x1b920a8?, 0x29ca010?}, {0x1b901c8?, 0xddbad402c00?}, 0x0)
        go/types/predicates.go:497 +0x805
go/types.(*comparer).identical(0xddbac7fb9de, {0x1b902e0?, 0x29ca000?}, {0x1b902e0?, 0xddbacbcd450?}, 0x0)
        go/types/predicates.go:311 +0x6ff
go/types.Identical(...)
        go/types/api_predicates.go:90
github.com/ryanrolds/sqlclosecheck/pkg/analyzer.getTargetTypesValues(0xddbac111d80?, 0x29f5fe0?, {0xddbac5d46c0, 0x3, 0x4?})
        github.com/ryanrolds/sqlclosecheck@v0.6.0/pkg/analyzer/defer_only.go:189 +0x1c5
github.com/ryanrolds/sqlclosecheck/pkg/analyzer.(*deferOnlyAnalyzer).Run(0xddbac7fbb78?, 0xddbac8c4540)
        github.com/ryanrolds/sqlclosecheck@v0.6.0/pkg/analyzer/defer_only.go:69 +0x19e
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*action).analyze.func3(...)
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_checker.go:180
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*action).analyze(0xddbae745380)
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_checker.go:206 +0xb6b
github.com/golangci/golangci-lint/v2/pkg/timeutils.(*Stopwatch).TrackStage(0xddbad635720, {0x183750e, 0xd}, 0xddbacd92710)
        github.com/golangci/golangci-lint/v2/pkg/timeutils/stopwatch.go:111 +0x44
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*action).analyzeSafe(0xddbae745380?)
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_action.go:59 +0x71
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*loadingPackage).analyze.func2()
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_loadingpackage.go:107 +0x65
golang.org/x/sync/errgroup.(*Group).Go.func1()
        golang.org/x/sync@v0.20.0/errgroup/errgroup.go:93 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 194
        golang.org/x/sync@v0.20.0/errgroup/errgroup.go:78 +0x95 
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: sqlclosecheck: package "main" (isInitialPkg: true, needAnalyzeSource: true): unreachable 
ERRO Running error: can't run linter goanalysis_metalinter
goanalysis_metalinter: sqlclosecheck: package "main" (isInitialPkg: true, needAnalyzeSource: true): unreachable 

A minimal reproducible example or link to a public repository

Details
package main

import (
	"context"
	"database/sql"
	"fmt"
	"iter"
	"sync"
)

type db struct {
	mu      sync.Mutex
	remotes map[string]*sql.DB
}

func (db *db) All() iter.Seq2[string, *sql.DB] {
	return func(yield func(string, *sql.DB) bool) {
		db.mu.Lock()
		defer db.mu.Unlock()
		for addr, r := range db.remotes {
			if !yield(addr, r) {
				return
			}
		}
	}
}

func (db *db) Foo(ctx context.Context) error {
	for addr, rem := range db.All() {
		rconn, err := rem.Conn(context.Background())
		if err != nil {
			return err
		}
		defer rconn.Close()

		rows, err := rconn.QueryContext(ctx, `SELECT * FROM foo`)
		if err != nil {
			return err
		}
		defer rows.Close()
		for rows.Next() {
			fmt.Println(rows.ColumnTypes())
		}
		if err := rows.Err(); err != nil {
			return err
		}
		fmt.Println(addr, rconn.PingContext(context.Background()))
	}
	return nil
}

func main() {
	d := &db{remotes: make(map[string]*sql.DB)}
	fmt.Println(d.Foo(context.Background()))
}

Validation

  • Yes, I've included all information above (version, config, etc.).

Supporter

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdependenciesRelates to an upstream dependency

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions