@cryptotaxi247 / kubo / commits / 1b5e4032f

refactor(init) extract context

Brian Tiger Chow committed Nov 4, 2014 at 03:56 UTC 1b5e4032ff88c60c1bef097cdf4ec1728cfd2f3b
1 file changed +4 -5
cmd/ipfs2/init.go
+4 -5
@@ -51,7 +51,7 @@ var initCmd = &cmds.Command{
51 nBitsForKeypair = 4096
52 }
53
54 - err := foo(res, req, dspath, force, nBitsForKeypair)
54 + err := foo(res, req.Context().ConfigRoot, dspath, force, nBitsForKeypair)
55 if err != nil {
56 res.SetError(err, cmds.ErrNormal)
57 return
@@ -59,11 +59,10 @@ var initCmd = &cmds.Command{
59 },
60 }
61
62 -func foo(res cmds.Response, req cmds.Request, dspath string, force bool, nBitsForKeypair int) error {
63 - ctx := req.Context()
62 +func foo(res cmds.Response, configRoot string, dspath string, force bool, nBitsForKeypair int) error {
63
65 - u.POut("initializing ipfs node at %s\n", ctx.ConfigRoot)
66 - filename, err := config.Filename(ctx.ConfigRoot)
64 + u.POut("initializing ipfs node at %s\n", configRoot)
65 + filename, err := config.Filename(configRoot)
66 if err != nil {
67 return errors.New("Couldn't get home directory path")
68 }