use *oldcmds.Context consistently instead of non-ptr
License: MIT Signed-off-by: keks <keks@cryptoscope.co>
keks committed
Dec 20, 2017 at 17:41 UTC
aec44bc430542d4f7a2cee906ad9da3e17722529
3 files changed
+7
-7
cmd/ipfs/daemon.go
+2
-2
@@ -432,7 +432,7 @@ func serveHTTPApi(req *cmds.Request, cctx *oldcmds.Context) (error, <-chan error
432
var opts = []corehttp.ServeOption{
433
corehttp.MetricsCollectionOption("api"),
434
corehttp.CheckVersionOption(),
435
- corehttp.CommandsOption(*cctx),
435
+ corehttp.CommandsOption(cctx),
436
corehttp.WebUIOption,
437
gatewayOpt,
438
corehttp.VersionOption(),
@@ -527,7 +527,7 @@ func serveHTTPGateway(req *cmds.Request, cctx *oldcmds.Context) (error, <-chan e
527
var opts = []corehttp.ServeOption{
528
corehttp.MetricsCollectionOption("gateway"),
529
corehttp.CheckVersionOption(),
530
- corehttp.CommandsROOption(*cctx),
530
+ corehttp.CommandsROOption(cctx),
531
corehttp.VersionOption(),
532
corehttp.IPNSHostnameOption(),
533
corehttp.GatewayOption(writable, "/ipfs", "/ipns"),
cmd/ipfswatch/main.go
+2
-2
@@ -186,8 +186,8 @@ func IsHidden(path string) bool {
186
return false
187
}
188
189
-func cmdCtx(node *core.IpfsNode, repoPath string) commands.Context {
190
- return commands.Context{
189
+func cmdCtx(node *core.IpfsNode, repoPath string) *commands.Context {
190
+ return &commands.Context{
191
Online: true,
192
ConfigRoot: repoPath,
193
LoadConfig: func(path string) (*config.Config, error) {
core/corehttp/commands.go
+3
-3
@@ -110,7 +110,7 @@ func patchCORSVars(c *cmdsHttp.ServerConfig, addr net.Addr) {
110
c.SetAllowedOrigins(origins...)
111
}
112
113
-func commandsOption(cctx oldcmds.Context, command *cmds.Command) ServeOption {
113
+func commandsOption(cctx *oldcmds.Context, command *cmds.Command) ServeOption {
114
return func(n *core.IpfsNode, l net.Listener, mux *http.ServeMux) (*http.ServeMux, error) {
115
116
cfg := cmdsHttp.NewServerConfig()
@@ -132,11 +132,11 @@ func commandsOption(cctx oldcmds.Context, command *cmds.Command) ServeOption {
132
}
133
}
134
135
-func CommandsOption(cctx oldcmds.Context) ServeOption {
135
+func CommandsOption(cctx *oldcmds.Context) ServeOption {
136
return commandsOption(cctx, corecommands.Root)
137
}
138
139
-func CommandsROOption(cctx oldcmds.Context) ServeOption {
139
+func CommandsROOption(cctx *oldcmds.Context) ServeOption {
140
return commandsOption(cctx, corecommands.RootRO)
141
}
142