This is also true in Go with type switches:
switch y := x.(type)
case MyStruct:
And with type assertions: y, ok := x.(MyInterface)
In both cases, y is of the correct type. The ok is optional, if omitted and the assertion fails, you'll get a runtime panic.