From 2106b4e3b117a048cd6e80006b1cc0b95757fe6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= <magik6k@gmail.com> Date: Thu, 14 Mar 2019 15:24:49 +0100 Subject: [PATCH] coreapi mfs: gofmt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Ćukasz Magiera <magik6k@gmail.com> --- core/coreapi/coreapi.go | 2 +- core/coreapi/mfs.go | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/core/coreapi/coreapi.go b/core/coreapi/coreapi.go index f6c0fe5a6..5811b3022 100644 --- a/core/coreapi/coreapi.go +++ b/core/coreapi/coreapi.go @@ -72,7 +72,7 @@ type CoreAPI struct { checkPublishAllowed func() error checkOnline func(allowOffline bool) error - filesRoot *mfs.Root // TODO: option filtering + filesRoot *mfs.Root // TODO: option filtering // ONLY for re-applying options in WithOptions, DO NOT USE ANYWHERE ELSE nd *core.IpfsNode diff --git a/core/coreapi/mfs.go b/core/coreapi/mfs.go index fa901ac73..a355c50f9 100644 --- a/core/coreapi/mfs.go +++ b/core/coreapi/mfs.go @@ -2,15 +2,15 @@ package coreapi import ( "context" + "errors" "fmt" - "github.com/ipfs/go-mfs" - "github.com/pkg/errors" "io" "os" gopath "path" "sync" "time" + "github.com/ipfs/go-mfs" coreiface "github.com/ipfs/interface-go-ipfs-core" ) @@ -19,7 +19,7 @@ const defaultDirPerm = 0755 type MfsAPI CoreAPI -type fileNodeInfo struct{ +type fileNodeInfo struct { l mfs.NodeListing } @@ -48,7 +48,7 @@ func (i *fileNodeInfo) Sys() interface{} { } func (api *MfsAPI) Create(ctx context.Context, path coreiface.MfsPath) (coreiface.File, error) { - return api.OpenFile(ctx, path, os.O_CREATE | os.O_WRONLY, defaultFilePerm) + return api.OpenFile(ctx, path, os.O_CREATE|os.O_WRONLY, defaultFilePerm) } func (api *MfsAPI) Open(ctx context.Context, path coreiface.MfsPath) (coreiface.File, error) { @@ -84,7 +84,6 @@ func (f *mfsFile) Close() error { return f.FileDescriptor.Close() } - func (f *mfsFile) ReadAt(p []byte, off int64) (int, error) { // TODO: implement in MFS with less locking f.lk.Lock() @@ -137,9 +136,9 @@ func (api *MfsAPI) OpenFile(ctx context.Context, path coreiface.MfsPath, flag in } flags := mfs.Flags{ - Read: flag & os.O_WRONLY == 0, - Write: flag & (os.O_WRONLY | os.O_RDWR) != 0, - Sync: flag & os.O_SYNC != 0, + Read: flag&os.O_WRONLY == 0, + Write: flag&(os.O_WRONLY|os.O_RDWR) != 0, + Sync: flag&os.O_SYNC != 0, } _, err = fn.Open(flags) @@ -250,8 +249,8 @@ func (api *MfsAPI) ReadDir(ctx context.Context, path coreiface.MfsPath) ([]os.Fi func (api *MfsAPI) MkdirAll(ctx context.Context, path coreiface.MfsPath, perm os.FileMode) error { return mfs.Mkdir(api.filesRoot, path.String(), mfs.MkdirOpts{ - Mkparents: true, - Flush: false, + Mkparents: true, + Flush: false, //CidBuilder: prefix, TODO }) } -- GitLab