Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
interface-go-dms3-core
Commits
3956a72f
Commit
3956a72f
authored
Dec 11, 2018
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coreapi WithOptions: apply on top of parent options
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
286ea29c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
options/global.go
options/global.go
+6
-2
No files found.
options/global.go
View file @
3956a72f
...
...
@@ -11,6 +11,10 @@ func ApiOptions(opts ...ApiOption) (*ApiSettings, error) {
Offline
:
false
,
}
return
ApiOptionsTo
(
options
,
opts
...
)
}
func
ApiOptionsTo
(
options
*
ApiSettings
,
opts
...
ApiOption
)
(
*
ApiSettings
,
error
)
{
for
_
,
opt
:=
range
opts
{
err
:=
opt
(
options
)
if
err
!=
nil
{
...
...
@@ -22,9 +26,9 @@ func ApiOptions(opts ...ApiOption) (*ApiSettings, error) {
type
apiOpts
struct
{}
var
Api
dag
Opts
var
Api
api
Opts
func
(
dag
Opts
)
Offline
(
offline
bool
)
ApiOption
{
func
(
api
Opts
)
Offline
(
offline
bool
)
ApiOption
{
return
func
(
settings
*
ApiSettings
)
error
{
settings
.
Offline
=
offline
return
nil
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment