Golang language interfaces are different from other languages. In Golang, type implements an interface through the implementation of its methods. There are no explicit declarations or no “implements” keyword.

BY Best Interview Question ON 04 Apr 2020


package main
import "fmt"
type I interface {
type T struct {
   S string
// This method means type T implements the interface I,
// but we don't need to explicitly declare that it does so.
func (t T) M() {
func main() {
  var i I = T{"hello"}