From 066d2f6b420b2d318d098db5b6074b278bdcecd4 Mon Sep 17 00:00:00 2001 From: Tamer Tas Date: Tue, 6 Sep 2016 19:12:24 +0300 Subject: [PATCH] idiom/functional-options: fix formatting and naming --- README.md | 2 +- idiom/{functional_options.md => functional-options.md} | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) rename idiom/{functional_options.md => functional-options.md} (99%) diff --git a/README.md b/README.md index 7efea6a..1fb281e 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ __Idioms__: | Pattern | Description | |:-------:| ----------- | -| [Functional Options](idiom/functional_options.md) | Allows creating clean APIs with sane defaults and idiomatic overrides | +| [Functional Options](idiom/functional-options.md) | Allows creating clean APIs with sane defaults and idiomatic overrides | __Anti-Patterns__: diff --git a/idiom/functional_options.md b/idiom/functional-options.md similarity index 99% rename from idiom/functional_options.md rename to idiom/functional-options.md index 435c5b8..1e95086 100644 --- a/idiom/functional_options.md +++ b/idiom/functional-options.md @@ -1,10 +1,12 @@ # Functional Options + Functional options are a method of implementing clean/eloquent APIs in Go. Options implemented as a function set the state of that option. ## Implementation ### Options + ```go package file @@ -44,6 +46,7 @@ func Permissions(perms os.FileMode) Option { ``` ### Constructor + ```go package file @@ -77,6 +80,7 @@ func New(filepath string, setters ...Option) error { ``` ## Usage + ```go emptyFile, err := file.New("/tmp/empty.txt") if err != nil {