-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Closed
Copy link
Labels
FrozenDueToAgeNeedsFixThe 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.TypeInferenceIssue is related to generic type inferenceIssue is related to generic type inferencecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
What version of Go are you using (go version
)?
$ go version go version go1.21.0 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/Users/momchil/Library/Caches/go-build' GOENV='/Users/momchil/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/Users/momchil/.go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users/momchil/.go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/local/Cellar/go/1.21.0/libexec' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/Cellar/go/1.21.0/libexec/pkg/tool/darwin_amd64' GOVCS='' GOVERSION='go1.21.0' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='cc' CXX='c++' CGO_ENABLED='1' GOMOD='/Users/momchil/Workspace/Tools/gotest/go.mod' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/w4/dj2vrtkn7x57h4fc45382jyw0000gn/T/go-build4050054595=/tmp/go-build -gno-record-gcc-switches -fno-common'
What did you do?
I tried to compile my project (that used to compile successfully with Go 1.20) but I get an error.
The project (with commit ref) is the following:
https://github.com/mokiat/gotest
The following command should run:
go test ./match
NOTE: While the project is just a playground at this point in time to see if generic matchers for testing and mocking might be possible in Go and the tests don't pass at the moment, the project does compile with Go 1.20 and does not with Go 1.21.
What did you expect to see?
ok github.com/mokiat/gotest/match 1.317s
What did you see instead?
# github.com/mokiat/gotest/match_test [github.com/mokiat/gotest/match.test]
match/eventually_test.go:46:16: type match.Matcher[<-chan string] of Eventually(Produces(Eq("hello"))) does not match inferred type match.Matcher[chan string] for match.Matcher[T]
FAIL github.com/mokiat/gotest/match [build failed]
FAIL
This can be fixed by casting the channel to a read-only channel.
Assert(c, ch, Eventually(Produces(Eq("hello"))))
needs to become
Assert(c, (<-chan string)(ch), Eventually(Produces(Eq("hello"))))
Nevertheless, this feels like a breaking change.
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe 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.TypeInferenceIssue is related to generic type inferenceIssue is related to generic type inferencecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.