diff --git a/src/param-naked.md b/src/param-naked.md index 357621d..80e2c75 100644 --- a/src/param-naked.md +++ b/src/param-naked.md @@ -1,6 +1,6 @@ # Avoid Naked Parameters -Prefer using (Functional Options)[#functional-options] instead of naked parameters or split your function into a few ones: +Prefer using [Functional Options](#functional-options) instead of naked parameters or split your function into a few ones:
| Bad | Good |
|---|
| Bad | Good |
|---|---|
| ```go -// func printInfo(name string, isLocal, done bool) +// func getInfo(name string, useCache bool) -printInfo("foo", true, true) +getInfo("foo", true) ``` | ```go -// func printInfo(name string, isLocal, done bool) +// func getInfo(name string) -printInfo("foo", true /* isLocal */, true /* done */) +// func getInfoUsingCache(name string) + +getInfo("foo") +getInfoUsingCache("foo") ``` |