Skip to content

cmd/compile: reflect.Type does not implement comparable #53249

Closed

Description

@limpo1989

What version of Go are you using (go version)?

$ go version
go version go1.18.2 windows/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
et GO111MODULE=on
set GOARCH=amd64
set GOBIN=      
set GOCACHE=C:\Users\Administrator\AppData\Local\go-build
set GOENV=C:\Users\Administrator\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=D:\gomod\pkg\mod
set GONOPROXY=***
set GONOSUMDB=***
set GOOS=windows
set GOPATH=D:\gomod;C:\Users\Administrator\go
set GOPRIVATE=git.idianhun.com,git.dianhun.cn
set GOPROXY=https://goproxy.io,direct
set GOROOT=D:\Go
set GOSUMDB=off
set GOTMPDIR=
set GOTOOLDIR=D:\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.18.2
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=*********\example\go.mod
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\ADMINI~1\AppData\Local\Temp\go-build1029863356=/tmp/go-build -gno-record-gcc-switches

What did you do?

https://go.dev/play/p/wSisCGgWwUg

// You can edit this code!
// Click here and start typing.
package main

import (
	"fmt"
	"reflect"

	"golang.org/x/exp/maps"
)

func main() {
	var types = make(map[reflect.Type]int)
	fmt.Println(maps.Keys(types))
}

What did you expect to see?

compiled successfully

What did you see instead?

./prog.go:14:23: reflect.Type does not implement comparable

Go build failed.

Activity

  1. seankhliao commented on Jun 6, 2022

    @seankhliao
    Member

    Duplicate of #52509 and others

  2. locked and limited conversation to collaborators on Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions