You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
GOHOSTARCH="amd64"
GOHOSTOS="linux"
What did you do?
The following compiled with go1.18rc1 but not with go1.18 final.
I am not sure if this was supposed to work like that or this was a bug in RC1 that was fixed, but it is useful when Handler is being used as a parameter to another type (say, Scheduler), which needs to call Handler with Work values. EDIT: seeing "has no field or" message tells me that this should be working.
package ticket
import (
"fmt"
)
type Work struct {
V int
}
type Handler[T Work] struct {
}
func (h *Handler[T]) Run(work T) {
fmt.Print(work.V)
}
What did you expect to see?
Successful compilation
$ go version
go version go1.18rc1 linux/amd64
$ go build x.go
$
What did you see instead?
$ go version
go version go1.18 linux/amd64
$ go build x.go
# command-line-arguments
./x.go:15:17: work.V undefined (type T has no field or method V)
$
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
The following compiled with go1.18rc1 but not with go1.18 final.
I am not sure if this was supposed to work like that or this was a bug in RC1 that was fixed, but it is useful when Handler is being used as a parameter to another type (say, Scheduler), which needs to call Handler with Work values. EDIT: seeing "has no field or" message tells me that this should be working.
What did you expect to see?
Successful compilation
What did you see instead?
The text was updated successfully, but these errors were encountered: