diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index 130648682..83a43702c 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -17,8 +17,10 @@ type BlockRmSettings struct { Force bool } -type BlockPutOption func(*BlockPutSettings) error -type BlockRmOption func(*BlockRmSettings) error +type ( + BlockPutOption func(*BlockPutSettings) error + BlockRmOption func(*BlockRmSettings) error +) func BlockPutOptions(opts ...BlockPutOption) (*BlockPutSettings, error) { var cidPrefix cid.Prefix @@ -131,7 +133,6 @@ func (blockOpts) Format(format string) BlockPutOption { return nil } - } // Hash is an option for Block.Put which specifies the multihash settings to use diff --git a/core/coreiface/options/dht.go b/core/coreiface/options/dht.go index e13e16020..b43bf3e7a 100644 --- a/core/coreiface/options/dht.go +++ b/core/coreiface/options/dht.go @@ -8,8 +8,10 @@ type DhtFindProvidersSettings struct { NumProviders int } -type DhtProvideOption func(*DhtProvideSettings) error -type DhtFindProvidersOption func(*DhtFindProvidersSettings) error +type ( + DhtProvideOption func(*DhtProvideSettings) error + DhtFindProvidersOption func(*DhtFindProvidersSettings) error +) func DhtProvideOptions(opts ...DhtProvideOption) (*DhtProvideSettings, error) { options := &DhtProvideSettings{ diff --git a/core/coreiface/options/key.go b/core/coreiface/options/key.go index 4bc53a65f..ebff6d5a7 100644 --- a/core/coreiface/options/key.go +++ b/core/coreiface/options/key.go @@ -16,8 +16,10 @@ type KeyRenameSettings struct { Force bool } -type KeyGenerateOption func(*KeyGenerateSettings) error -type KeyRenameOption func(*KeyRenameSettings) error +type ( + KeyGenerateOption func(*KeyGenerateSettings) error + KeyRenameOption func(*KeyRenameSettings) error +) func KeyGenerateOptions(opts ...KeyGenerateOption) (*KeyGenerateSettings, error) { options := &KeyGenerateSettings{ diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index 8e9b5183d..35e78c394 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -24,8 +24,10 @@ type NameResolveSettings struct { ResolveOpts []ropts.ResolveOpt } -type NamePublishOption func(*NamePublishSettings) error -type NameResolveOption func(*NameResolveSettings) error +type ( + NamePublishOption func(*NamePublishSettings) error + NameResolveOption func(*NameResolveSettings) error +) func NamePublishOptions(opts ...NamePublishOption) (*NamePublishSettings, error) { options := &NamePublishSettings{ diff --git a/core/coreiface/options/object.go b/core/coreiface/options/object.go index e484a9f36..b5625a1d6 100644 --- a/core/coreiface/options/object.go +++ b/core/coreiface/options/object.go @@ -14,9 +14,11 @@ type ObjectAddLinkSettings struct { Create bool } -type ObjectNewOption func(*ObjectNewSettings) error -type ObjectPutOption func(*ObjectPutSettings) error -type ObjectAddLinkOption func(*ObjectAddLinkSettings) error +type ( + ObjectNewOption func(*ObjectNewSettings) error + ObjectPutOption func(*ObjectPutSettings) error + ObjectAddLinkOption func(*ObjectAddLinkSettings) error +) func ObjectNewOptions(opts ...ObjectNewOption) (*ObjectNewSettings, error) { options := &ObjectNewSettings{ diff --git a/core/coreiface/options/pubsub.go b/core/coreiface/options/pubsub.go index c387d613d..839ef97b1 100644 --- a/core/coreiface/options/pubsub.go +++ b/core/coreiface/options/pubsub.go @@ -8,8 +8,10 @@ type PubSubSubscribeSettings struct { Discover bool } -type PubSubPeersOption func(*PubSubPeersSettings) error -type PubSubSubscribeOption func(*PubSubSubscribeSettings) error +type ( + PubSubPeersOption func(*PubSubPeersSettings) error + PubSubSubscribeOption func(*PubSubSubscribeSettings) error +) func PubSubPeersOptions(opts ...PubSubPeersOption) (*PubSubPeersSettings, error) { options := &PubSubPeersSettings{ diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index dd12502e6..f00fffb87 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -43,8 +43,10 @@ type UnixfsLsSettings struct { UseCumulativeSize bool } -type UnixfsAddOption func(*UnixfsAddSettings) error -type UnixfsLsOption func(*UnixfsLsSettings) error +type ( + UnixfsAddOption func(*UnixfsAddSettings) error + UnixfsLsOption func(*UnixfsLsSettings) error +) func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, error) { options := &UnixfsAddSettings{ diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index ba74031f9..b9a03c8f4 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -31,15 +31,13 @@ func (tp *TestSuite) TestDag(t *testing.T) { t.Run("TestBatch", tp.TestBatch) } -var ( - treeExpected = map[string]struct{}{ - "a": {}, - "b": {}, - "c": {}, - "c/d": {}, - "c/e": {}, - } -) +var treeExpected = map[string]struct{}{ + "a": {}, + "b": {}, + "c": {}, + "c/d": {}, + "c/e": {}, +} func (tp *TestSuite) TestPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index ab55d0425..74d88edff 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -164,4 +164,4 @@ func (tp *TestSuite) TestBasicPublishResolveTimeout(t *testing.T) { require.NoError(t, err) } -//TODO: When swarm api is created, add multinode tests +// TODO: When swarm api is created, add multinode tests diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index 77061b699..63c218eb3 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -74,7 +74,7 @@ func (tp *TestSuite) TestObjectPut(t *testing.T) { t.Fatal(err) } - p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"YmFy"}`), opt.Object.DataType("base64")) //bar + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"YmFy"}`), opt.Object.DataType("base64")) // bar if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 2842b47bc..25c3ac1b7 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -53,8 +53,10 @@ func (tp *TestSuite) TestUnixfs(t *testing.T) { } // `echo -n 'hello, world!' | ipfs add` -var hello = "/ipfs/QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk" -var helloStr = "hello, world!" +var ( + hello = "/ipfs/QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk" + helloStr = "hello, world!" +) // `echo -n | ipfs add` var emptyFile = "/ipfs/QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH" @@ -213,7 +215,7 @@ func (tp *TestSuite) TestAdd(t *testing.T) { path: "/ipfs/bafkqaaa", opts: []options.UnixfsAddOption{options.Unixfs.InlineLimit(0), options.Unixfs.Inline(true), options.Unixfs.RawLeaves(true)}, }, - { //TODO: after coreapi add is used in `ipfs add`, consider making this default for inline + { // TODO: after coreapi add is used in `ipfs add`, consider making this default for inline name: "addInlineRaw", data: strFile(helloStr), path: "/ipfs/bafkqadlimvwgy3zmeb3w64tmmqqq",