package main
import (
"fmt"
)
type Pet struct {
Name string
}
func checkIsNil(v any) {
fmt.Println(v == nil)
}
func main() {
var x *Pet
var y *Pet = &Pet{"Alpha"}
checkIsNil(x)
checkIsNil(y)
}
What will be printed?
Under the covers, interfaces are implemented as two elements, a type T and a value V.
An interface value is nil only if the V and T are both unset, (T=nil, V is not set).