Skip to content

Instantly share code, notes, and snippets.

@jcdan3
Created December 12, 2021 19:48
Show Gist options
  • Select an option

  • Save jcdan3/d50102e48cf6b06f829416ec1d9c47ac to your computer and use it in GitHub Desktop.

Select an option

Save jcdan3/d50102e48cf6b06f829416ec1d9c47ac to your computer and use it in GitHub Desktop.
package mockingdemo
import "os"
type FileConnector interface{
ReadFromFile(name string) ([]byte, error)
}
type fileConnector struct{}
func NewFileConnector() FileConnector{
return &fileConnector{}
}
func (f*fileConnector) ReadFromFile(filename string) ([]byte, error){
data, err := os.ReadFile(filename)
if err != nil{
return nil, err
}
return data, err
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment