I am referring to the code in this link: Interfaces in Golang
Under the "Type assertions" section, the first piece of code has a line like so in the main function: var val interface {} = "Geeks for Geeks"
I did not understand this syntax. Usually, we create an interface type at the package level like
type some_interface interface {
// methods
}
and then create a variable of this interface type var s some_interface
for use. What does this line actually do? Is it an "anonymous interface
" (like anonymous struct
). What is the use of declaring an interface using this method?
Thanks in advance