mirror of
https://github.com/Pungyeon/clean-go-article.git
synced 2024-11-27 07:34:05 +00:00
Correct minor verb tense error
This commit is contained in:
parent
21667dcfa7
commit
f81827672d
|
@ -263,7 +263,7 @@ First, indentation hell makes it difficult for other developers to understand th
|
||||||
|
|
||||||
Indentation hell can result in reader fatigue if a developer has to constantly parse unwieldy code like the sample above. Naturally, this is something we want to avoid at all costs.
|
Indentation hell can result in reader fatigue if a developer has to constantly parse unwieldy code like the sample above. Naturally, this is something we want to avoid at all costs.
|
||||||
|
|
||||||
So, how do we clean this function? Fortunately, it's actually quite simple. On our first iteration, we will try to ensure that we are returning an error as soon as possible. Instead of nested the `if` and `else` statements, we want to "push our code to the left," so to speak. Take a look:
|
So, how do we clean this function? Fortunately, it's actually quite simple. On our first iteration, we will try to ensure that we are returning an error as soon as possible. Instead of nesting the `if` and `else` statements, we want to "push our code to the left," so to speak. Take a look:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GetItem(extension string) (Item, error) {
|
func GetItem(extension string) (Item, error) {
|
||||||
|
|
Loading…
Reference in a new issue