The basic Read method

Hi in package io , there is function Read. I want to know how this basic Read is implemented? by calling libc library or Go write it by itself?? Thanks a lot for response !!!

type Reader interface {

Read(p []byte) (n int, err error)

}

An interface has no implementation. Instead, you can instantiate objects (and also write such objects yourself) that satisfy this interface, like, for example:

  • *os.File (through os.Open)
  • *net.tcpConn
  • *bytes.Buffer
  • strings.Reader

etc.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.