coreapi: don't use underscores in opt reciever funcs
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com> This commit was moved from ipfs/interface-go-ipfs-core@8b65fc5e1ed16902cda0e3e36fe624b01856b182 This commit was moved from ipfs/boxo@6bd3ea5ab8c0df771963b4f8a9f5cfdc18a95b6d
Łukasz Magiera committed
Mar 25, 2018 at 14:09 UTC
b5d36c8a1b2d8477021f4a7c3b044bfc5913e173
6 files changed
+26
-26
core/coreiface/options/block.go
+3
-3
@@ -53,7 +53,7 @@ var Block blockOpts
53
54
// Format is an option for Block.Put which specifies the multicodec to use to
55
// serialize the object. Default is "v0"
56
-func (_ blockOpts) Format(codec string) BlockPutOption {
56
+func (blockOpts) Format(codec string) BlockPutOption {
57
return func(settings *BlockPutSettings) error {
58
settings.Codec = codec
59
return nil
@@ -63,7 +63,7 @@ func (_ blockOpts) Format(codec string) BlockPutOption {
63
// Hash is an option for Block.Put which specifies the multihash settings to use
64
// when hashing the object. Default is mh.SHA2_256 (0x12).
65
// If mhLen is set to -1, default length for the hash will be used
66
-func (_ blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption {
66
+func (blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption {
67
return func(settings *BlockPutSettings) error {
68
settings.MhType = mhType
69
settings.MhLength = mhLen
@@ -73,7 +73,7 @@ func (_ blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption {
73
74
// Force is an option for Block.Rm which, when set to true, will ignore
75
// non-existing blocks
76
-func (_ blockOpts) Force(force bool) BlockRmOption {
76
+func (blockOpts) Force(force bool) BlockRmOption {
77
return func(settings *BlockRmSettings) error {
78
settings.Force = force
79
return nil
core/coreiface/options/dag.go
+4
-4
@@ -57,7 +57,7 @@ var Dag dagOpts
57
58
// InputEnc is an option for Dag.Put which specifies the input encoding of the
59
// data. Default is "json", most formats/codecs support "raw"
60
-func (_ dagOpts) InputEnc(enc string) DagPutOption {
60
+func (dagOpts) InputEnc(enc string) DagPutOption {
61
return func(settings *DagPutSettings) error {
62
settings.InputEnc = enc
63
return nil
@@ -66,7 +66,7 @@ func (_ dagOpts) InputEnc(enc string) DagPutOption {
66
67
// Codec is an option for Dag.Put which specifies the multicodec to use to
68
// serialize the object. Default is cid.DagCBOR (0x71)
69
-func (_ dagOpts) Codec(codec uint64) DagPutOption {
69
+func (dagOpts) Codec(codec uint64) DagPutOption {
70
return func(settings *DagPutSettings) error {
71
settings.Codec = codec
72
return nil
@@ -77,7 +77,7 @@ func (_ dagOpts) Codec(codec uint64) DagPutOption {
77
// when hashing the object. Default is based on the codec used
78
// (mh.SHA2_256 (0x12) for DagCBOR). If mhLen is set to -1, default length for
79
// the hash will be used
80
-func (_ dagOpts) Hash(mhType uint64, mhLen int) DagPutOption {
80
+func (dagOpts) Hash(mhType uint64, mhLen int) DagPutOption {
81
return func(settings *DagPutSettings) error {
82
settings.MhType = mhType
83
settings.MhLength = mhLen
@@ -87,7 +87,7 @@ func (_ dagOpts) Hash(mhType uint64, mhLen int) DagPutOption {
87
88
// Depth is an option for Dag.Tree which specifies maximum depth of the
89
// returned tree. Default is -1 (no depth limit)
90
-func (_ dagOpts) Depth(depth int) DagTreeOption {
90
+func (dagOpts) Depth(depth int) DagTreeOption {
91
return func(settings *DagTreeSettings) error {
92
settings.Depth = depth
93
return nil
core/coreiface/options/key.go
+3
-3
@@ -58,7 +58,7 @@ var Key keyOpts
58
// Supported key types:
59
// * options.RSAKey
60
// * options.Ed25519Key
61
-func (_ keyOpts) Type(algorithm string) KeyGenerateOption {
61
+func (keyOpts) Type(algorithm string) KeyGenerateOption {
62
return func(settings *KeyGenerateSettings) error {
63
settings.Algorithm = algorithm
64
return nil
@@ -70,7 +70,7 @@ func (_ keyOpts) Type(algorithm string) KeyGenerateOption {
70
//
71
// value of -1 means 'use default size for key type':
72
// * 2048 for RSA
73
-func (_ keyOpts) Size(size int) KeyGenerateOption {
73
+func (keyOpts) Size(size int) KeyGenerateOption {
74
return func(settings *KeyGenerateSettings) error {
75
settings.Size = size
76
return nil
@@ -79,7 +79,7 @@ func (_ keyOpts) Size(size int) KeyGenerateOption {
79
80
// Force is an option for Key.Rename which specifies whether to allow to
81
// replace existing keys.
82
-func (_ keyOpts) Force(force bool) KeyRenameOption {
82
+func (keyOpts) Force(force bool) KeyRenameOption {
83
return func(settings *KeyRenameSettings) error {
84
settings.Force = force
85
return nil
core/coreiface/options/name.go
+5
-5
@@ -61,7 +61,7 @@ var Name nameOpts
61
62
// ValidTime is an option for Name.Publish which specifies for how long the
63
// entry will remain valid. Default value is 24h
64
-func (_ nameOpts) ValidTime(validTime time.Duration) NamePublishOption {
64
+func (nameOpts) ValidTime(validTime time.Duration) NamePublishOption {
65
return func(settings *NamePublishSettings) error {
66
settings.ValidTime = validTime
67
return nil
@@ -73,7 +73,7 @@ func (_ nameOpts) ValidTime(validTime time.Duration) NamePublishOption {
73
// The key parameter must be either PeerID or keystore key alias.
74
//
75
// You can use KeyAPI to list and generate more names and their respective keys.
76
-func (_ nameOpts) Key(key string) NamePublishOption {
76
+func (nameOpts) Key(key string) NamePublishOption {
77
return func(settings *NamePublishSettings) error {
78
settings.Key = key
79
return nil
@@ -82,7 +82,7 @@ func (_ nameOpts) Key(key string) NamePublishOption {
82
83
// Recursive is an option for Name.Resolve which specifies whether to perform a
84
// recursive lookup. Default value is false
85
-func (_ nameOpts) Recursive(recursive bool) NameResolveOption {
85
+func (nameOpts) Recursive(recursive bool) NameResolveOption {
86
return func(settings *NameResolveSettings) error {
87
settings.Recursive = recursive
88
return nil
@@ -91,7 +91,7 @@ func (_ nameOpts) Recursive(recursive bool) NameResolveOption {
91
92
// Local is an option for Name.Resolve which specifies if the lookup should be
93
// offline. Default value is false
94
-func (_ nameOpts) Local(local bool) NameResolveOption {
94
+func (nameOpts) Local(local bool) NameResolveOption {
95
return func(settings *NameResolveSettings) error {
96
settings.Local = local
97
return nil
@@ -100,7 +100,7 @@ func (_ nameOpts) Local(local bool) NameResolveOption {
100
101
// Cache is an option for Name.Resolve which specifies if cache should be used.
102
// Default value is true
103
-func (_ nameOpts) Cache(cache bool) NameResolveOption {
103
+func (nameOpts) Cache(cache bool) NameResolveOption {
104
return func(settings *NameResolveSettings) error {
105
settings.Cache = cache
106
return nil
core/coreiface/options/object.go
+4
-4
@@ -70,7 +70,7 @@ var Object objectOpts
70
// Supported types:
71
// * 'empty' - Empty node
72
// * 'unixfs-dir' - Empty UnixFS directory
73
-func (_ objectOpts) Type(t string) ObjectNewOption {
73
+func (objectOpts) Type(t string) ObjectNewOption {
74
return func(settings *ObjectNewSettings) error {
75
settings.Type = t
76
return nil
@@ -83,7 +83,7 @@ func (_ objectOpts) Type(t string) ObjectNewOption {
83
// Supported encodings:
84
// * "protobuf"
85
// * "json"
86
-func (_ objectOpts) InputEnc(e string) ObjectPutOption {
86
+func (objectOpts) InputEnc(e string) ObjectPutOption {
87
return func(settings *ObjectPutSettings) error {
88
settings.InputEnc = e
89
return nil
@@ -96,7 +96,7 @@ func (_ objectOpts) InputEnc(e string) ObjectPutOption {
96
// Supported types:
97
// * "text" (default)
98
// * "base64"
99
-func (_ objectOpts) DataType(t string) ObjectPutOption {
99
+func (objectOpts) DataType(t string) ObjectPutOption {
100
return func(settings *ObjectPutSettings) error {
101
settings.DataType = t
102
return nil
@@ -105,7 +105,7 @@ func (_ objectOpts) DataType(t string) ObjectPutOption {
105
106
// Create is an option for Object.AddLink which specifies whether create required
107
// directories for the child
108
-func (_ objectOpts) Create(create bool) ObjectAddLinkOption {
108
+func (objectOpts) Create(create bool) ObjectAddLinkOption {
109
return func(settings *ObjectAddLinkSettings) error {
110
settings.Create = create
111
return nil
core/coreiface/options/pin.go
+7
-7
@@ -71,31 +71,31 @@ var Pin pinOpts
71
72
// All is an option for Pin.Ls which will make it return all pins. It is
73
// the default
74
-func (_ pinType) All() PinLsOption {
74
+func (pinType) All() PinLsOption {
75
return Pin.pinType("all")
76
}
77
78
// Recursive is an option for Pin.Ls which will make it only return recursive
79
// pins
80
-func (_ pinType) Recursive() PinLsOption {
80
+func (pinType) Recursive() PinLsOption {
81
return Pin.pinType("recursive")
82
}
83
84
// Direct is an option for Pin.Ls which will make it only return direct (non
85
// recursive) pins
86
-func (_ pinType) Direct() PinLsOption {
86
+func (pinType) Direct() PinLsOption {
87
return Pin.pinType("direct")
88
}
89
90
// Indirect is an option for Pin.Ls which will make it only return indirect pins
91
// (objects referenced by other recursively pinned objects)
92
-func (_ pinType) Indirect() PinLsOption {
92
+func (pinType) Indirect() PinLsOption {
93
return Pin.pinType("indirect")
94
}
95
96
// Recursive is an option for Pin.Add which specifies whether to pin an entire
97
// object tree or just one object. Default: true
98
-func (_ pinOpts) Recursive(recucsive bool) PinAddOption {
98
+func (pinOpts) Recursive(recucsive bool) PinAddOption {
99
return func(settings *PinAddSettings) error {
100
settings.Recursive = recucsive
101
return nil
@@ -111,7 +111,7 @@ func (_ pinOpts) Recursive(recucsive bool) PinAddOption {
111
// * "indirect" - indirectly pinned objects (referenced by recursively pinned
112
// objects)
113
// * "all" - all pinned objects (default)
114
-func (_ pinOpts) pinType(t string) PinLsOption {
114
+func (pinOpts) pinType(t string) PinLsOption {
115
return func(settings *PinLsSettings) error {
116
settings.Type = t
117
return nil
@@ -120,7 +120,7 @@ func (_ pinOpts) pinType(t string) PinLsOption {
120
121
// Unpin is an option for Pin.Update which specifies whether to remove the old pin.
122
// Default is true.
123
-func (_ pinOpts) Unpin(unpin bool) PinUpdateOption {
123
+func (pinOpts) Unpin(unpin bool) PinUpdateOption {
124
return func(settings *PinUpdateSettings) error {
125
settings.Unpin = unpin
126
return nil