-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
Go version
go version go1.24.2 linux/amd64
Output of go env
in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1565376817=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/home/user/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/user/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib64/go/1.24'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/user/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/lib64/go/1.24/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24.2'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
Minimal example to reproduce:
package main
import (
"hash/maphash"
)
func main() {
maphash.Comparable(maphash.MakeSeed(), make(chan struct{}))
}
What did you see happen?
Run with go run -tags purego main.go
causes panic:
$ go run -tags purego main.go
panic: maphash: hash of unhashable type chan struct {}
goroutine 1 [running]:
hash/maphash.appendT(0xc0000a0e78, {0x497e40?, 0xc000096070?, 0x4112fe?})
/usr/lib64/go/1.24/src/hash/maphash/maphash_purego.go:176 +0x6f7
hash/maphash.writeComparable[...](0xc0000a0e78?, 0x1c0000a0f08)
/usr/lib64/go/1.24/src/hash/maphash/maphash_purego.go:111 +0x31
hash/maphash.comparableHash[...](0x0?, {0x552308?})
/usr/lib64/go/1.24/src/hash/maphash/maphash_purego.go:105 +0x58
hash/maphash.Comparable[...](...)
/usr/lib64/go/1.24/src/hash/maphash/maphash.go:289
main.main()
/home/user/src/1/main.go:8 +0x3d
exit status 2
The problem is that purego implementation of maphash doesn't handle reflect.Chan
kind of values: https://cs.opensource.google/go/go/+/refs/tags/go1.24.3:src/hash/maphash/maphash_purego.go;l=115-175
I can submit pull request which will make it handle reflect.Chan
as every other pointer types, hashing v.Pointer()
value.
What did you expect to see?
No panic like with regular go run main.go
command.
qiulaidongfeng
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.