title: How to define an interface using another interface
body: <p>In Go, how to define an interface using another interface?</p>
  <p>Here is an example:</p>
  <pre><code>package main
  
  import (
      &quot;fmt&quot;
  )
  
  // Interfaces
  type Message interface {
      Read() string
  }
  
  type MessageReader interface {
      ReceiveMessages([]Message)
  }
  
  // Structs
  type SQSMessage struct {
      Content string
  }
  
  type SQSMessageReader struct {
      Name string
  }
  
  // Implements
  func (reader *SQSMessageReader) ReceiveMessages([]SQSMessage) {
  }
  
  func (msg *SQSMessage) Read() string {
      return msg.Content
  }
  
  // A function needs a reader interface
  func FuncNeedsReader(MessageReader) {
      fmt.Println(&quot;get reader&quot;)
  }
  
  func main() {
      var reader SQSMessageReader
      FuncNeedsReader(reader)
  }
  </code></pre>
  <p>I got error:</p>
  <pre><code>./prog.go:40:17: cannot use reader (type SQSMessageReader) as type MessageReader in argument to FuncNeedsReader:
      SQSMessageReader does not implement MessageReader (wrong type for ReceiveMessages method)
          have ReceiveMessages([]SQSMessage)
          want ReceiveMessages([]Message)
  </code></pre>
  <p>Do anyone know if this design is conflicting with Go's design?</p>
  <p>I know we have &quot;accept interfaces, return structs&quot;
  So I also tried <a href="https://play.golang.org/p/qdGaKRYAqw7" rel="nofollow noreferrer">https://play.golang.org/p/qdGaKRYAqw7</a>, but still fail with similar error.</p>