Type Assertion
A type assertion provides access to the underlying concrete value of an interface value.
When the instance of a struct is converted to an interface, this instance continues to exist, but now we only have access to the methods that the interface allows.
Note, for example, that when we convert an instance of the Person type (see the previous example), we lose access to the struct's fields and to methods not defined by the interface:
carlito := Person{"Carlito da Silva"}
var talker talker = carlito
// We no longer have access
fmt.Println(carlito.Name)
fmt.Println(carlito.Scream("Bingo"))
Although we no longer have access to these values, we can retrieve them by converting the interface to its original type. That's because, under the covers, Go leaves its original instance "guarded".
carlitoRecovered := talkative.(Person)
// Now we have access
fmt.Println(carlitoRecuperado.Name)
fmt.Println(carlitoRecuperado.Scream("Bingo"))