-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
urso
committed
Mar 19, 2016
1 parent
a957a52
commit 8af1043
Showing
3 changed files
with
39 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package ucfg | ||
|
||
type Option func(*options) | ||
|
||
type options struct { | ||
tag string | ||
pathSep string | ||
} | ||
|
||
func StructTag(tag string) Option { | ||
return func(o *options) { | ||
o.tag = tag | ||
} | ||
} | ||
|
||
func PathSep(sep string) Option { | ||
return func(o *options) { | ||
o.pathSep = sep | ||
} | ||
} | ||
|
||
func makeOptions(opts []Option) options { | ||
o := options{ | ||
tag: "config", | ||
pathSep: "", // no separator by default | ||
} | ||
for _, opt := range opts { | ||
opt(&o) | ||
} | ||
return o | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters