Update README.md

Co-Authored-By: Aleksandr H <aleksandrhovhannisyan@gmail.com>
This commit is contained in:
Lasse Martin Jakobsen 2019-07-11 13:20:04 +02:00 committed by GitHub
parent 828fd65cfa
commit cf168cce6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1068,7 +1068,7 @@ func NewNullWriter() io.Writer {
The above function ensures that the `NullWriter` struct implements the `Writer` interface. If we were to delete the `Write` method from `NullWriter`, we would get a compilation error. This is a good way of ensuring that our code behaves as expected and that we can rely on the compiler as a safety net in case we try to write invalid code.
In certain cases, it might not be desirable to write a constructor, or perhaps we would like for our constructor to return the concrete type, rather than the interface. As an example, the `NullWriter` struct has no properties to populate on initialisation and therefore writing a constructor is a little redundant. Therefore, we can use the less verbose method of checking interface compatibility:
In certain cases, it might not be desirable to write a constructor, or perhaps we would like for our constructor to return the concrete type, rather than the interface. As an example, the `NullWriter` struct has no properties to populate on initialisation, so writing a constructor is a little redundant. Therefore, we can use the less verbose method of checking interface compatibility:
```go
type Writer interface {