@cryptotaxi247 / kubo / commits / d93c0b6a4

Revert "use *oldcmds.Context consistently instead of non-ptr"

This reverts commit 852adb1c4a42a254286ac26b3bae7ea3a7bb69df. License: MIT Signed-off-by: keks <keks@cryptoscope.co>

keks committed Dec 20, 2017 at 18:46 UTC d93c0b6a4b75fa886e2fd6c0ec587d04be0a20c2
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