mirror of
https://github.com/teivah/100-go-mistakes.git
synced 2026-06-21 00:47:11 +08:00
Merge pull request #98 from aermolaev/patch-1
Update 5-interface-pollution.md: typo fixed
This commit is contained in:
commit
22ac4b3e17
1 changed files with 1 additions and 1 deletions
|
|
@ -47,7 +47,7 @@ Custom implementations of `io.Writer` should write the data coming from a slice
|
||||||
|
|
||||||
What is the rationale for having these two interfaces in the language? What is the point of creating these abstractions?
|
What is the rationale for having these two interfaces in the language? What is the point of creating these abstractions?
|
||||||
|
|
||||||
Let’s assume we need to implement a function that should copy the content of one file to another. We could create a specific function that would take as input two `*os.Files`. Or, we can choose to create a more generic function using `io.Reader` and `io.Writer` abstractions:
|
Let’s assume we need to implement a function that should copy the content of one file to another. We could create a specific function that would take as input two `*os.File`. Or, we can choose to create a more generic function using `io.Reader` and `io.Writer` abstractions:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func copySourceToDest(source io.Reader, dest io.Writer) error {
|
func copySourceToDest(source io.Reader, dest io.Writer) error {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue