Complete the code to define an interface named Speaker.
type Speaker [1] {
Speak() string
}struct instead of interface to define an interface.interface.The keyword interface is used to define an interface in Go.
Complete the code to declare a method Speak() that returns a string in the interface.
type Speaker interface {
[1]() string
}The method name in the interface is Speak which returns a string.
Fix the error in the interface definition by completing the code.
type [1] interface {
Speak() string
}Interface names in Go are usually capitalized and descriptive. Here, Speaker is the correct name.
Fill both blanks to define an interface named Reader with a method Read that returns an int and an error.
type [1] interface { [2]() (int, error) }
The interface is named Reader and the method is Read which returns an int and an error.
Fill all three blanks to define an interface named Writer with a method Write that takes a byte slice and returns an int and an error.
type [1] interface { [2]([3] []byte) (int, error) }
The interface is Writer, the method is Write, and the parameter name is data which is a byte slice.