From e9bd1a3354554f7ffe9db800641fbd7aabfdc0d9 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 27 Apr 2015 09:44:23 -0700 Subject: [PATCH] cmd/ipfswatch/main: Replace coreunix.Add with coreunix.AddR No need to convert from a path to a reader locally, when AddR will do that for us. This also future-proofs us from AddR enhancements that will pull other information about the added file from the filesystem besides the data (e.g. access mode, owner and group ID, ...). --- cmd/ipfswatch/main.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cmd/ipfswatch/main.go b/cmd/ipfswatch/main.go index 87570e35643..c133039eb3d 100644 --- a/cmd/ipfswatch/main.go +++ b/cmd/ipfswatch/main.go @@ -121,12 +121,7 @@ func run(ipfsPath, watchPath string) error { } } proc.Go(func(p process.Process) { - file, err := os.Open(e.Name) - if err != nil { - log.Println(err) - } - defer file.Close() - k, err := coreunix.Add(node, file) + k, err := coreunix.AddR(node, e.Name) if err != nil { log.Println(err) }