Skip to content

Commit be4faf7

Browse files
authored
Merge pull request #110 from D4ryl00/chore/update-ipfs
chore: update kubo to 0.27.0
2 parents f638d42 + 27f4e0a commit be4faf7

File tree

20 files changed

+948
-2306
lines changed

20 files changed

+948
-2306
lines changed

.github/workflows/go.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ jobs:
1414
strategy:
1515
matrix:
1616
golang:
17-
- '1.19.x'
17+
- "1.21.x"
1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
- name: Set up Go
21-
uses: actions/setup-go@v4
21+
uses: actions/setup-go@v5
2222
with:
2323
go-version: ${{ matrix.golang }}
24+
cache: false
2425
- name: golangci-lint
25-
uses: golangci/golangci-lint-action@v3.3.0
26+
uses: golangci/golangci-lint-action@v4
2627
with:
27-
go-version: ${{ matrix.golang }}
28-
version: v1.50.1
28+
version: v1.54
2929
args: --timeout=10m
3030
# only-new-issues: true
3131

@@ -34,8 +34,8 @@ jobs:
3434
strategy:
3535
matrix:
3636
golang:
37-
- '1.19'
38-
- '1.20'
37+
- "1.21"
38+
- "1.22"
3939
env:
4040
OS: ubuntu-latest
4141
GOLANG: ${{ matrix.golang }}
@@ -80,8 +80,8 @@ jobs:
8080
strategy:
8181
matrix:
8282
golang:
83-
- '1.19'
84-
- '1.20'
83+
- "1.21"
84+
- "1.22"
8585
env:
8686
OS: macos-latest
8787
GOLANG: ${{ matrix.golang }}

.tool-versions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
golang 1.19.7
2-
golangci-lint 1.50.1
1+
golang 1.21.8
2+
golangci-lint 1.54.2

entry/entry.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"sort"
99

1010
"github.com/ipfs/go-cid"
11-
core_iface "github.com/ipfs/interface-go-ipfs-core"
11+
coreiface "github.com/ipfs/kubo/core/coreiface"
1212
"github.com/multiformats/go-multibase"
1313

1414
"berty.tech/go-ipfs-log/errmsg"
@@ -134,7 +134,7 @@ func (e *Entry) SetAdditionalDataValue(key string, value string) {
134134
e.AdditionalData[key] = value
135135
}
136136

137-
func CreateEntry(ctx context.Context, ipfsInstance core_iface.CoreAPI, identity *identityprovider.Identity, data *Entry, opts *iface.CreateEntryOptions) (iface.IPFSLogEntry, error) {
137+
func CreateEntry(ctx context.Context, ipfsInstance coreiface.CoreAPI, identity *identityprovider.Identity, data *Entry, opts *iface.CreateEntryOptions) (iface.IPFSLogEntry, error) {
138138
io, err := cbor.IO(&Entry{}, &LamportClock{})
139139
if err != nil {
140140
return nil, err
@@ -144,7 +144,7 @@ func CreateEntry(ctx context.Context, ipfsInstance core_iface.CoreAPI, identity
144144
}
145145

146146
// CreateEntryWithIO creates an Entry.
147-
func CreateEntryWithIO(ctx context.Context, ipfsInstance core_iface.CoreAPI, identity *identityprovider.Identity, data iface.IPFSLogEntry, opts *iface.CreateEntryOptions, io iface.IO) (iface.IPFSLogEntry, error) {
147+
func CreateEntryWithIO(ctx context.Context, ipfsInstance coreiface.CoreAPI, identity *identityprovider.Identity, data iface.IPFSLogEntry, opts *iface.CreateEntryOptions, io iface.IO) (iface.IPFSLogEntry, error) {
148148
if ipfsInstance == nil {
149149
return nil, errmsg.ErrIPFSNotDefined
150150
}
@@ -394,7 +394,7 @@ func (e *Entry) Verify(identity identityprovider.Interface, io iface.IO) error {
394394
}
395395

396396
// ToMultihash gets the multihash of an Entry.
397-
func (e *Entry) ToMultihash(ctx context.Context, ipfsInstance core_iface.CoreAPI, opts *iface.CreateEntryOptions) (cid.Cid, error) {
397+
func (e *Entry) ToMultihash(ctx context.Context, ipfsInstance coreiface.CoreAPI, opts *iface.CreateEntryOptions) (cid.Cid, error) {
398398
io, err := cbor.IO(&Entry{}, &LamportClock{})
399399
if err != nil {
400400
return cid.Undef, err
@@ -404,7 +404,7 @@ func (e *Entry) ToMultihash(ctx context.Context, ipfsInstance core_iface.CoreAPI
404404
}
405405

406406
// ToMultihashWithIO gets the multihash of an Entry.
407-
func ToMultihashWithIO(ctx context.Context, e iface.IPFSLogEntry, ipfsInstance core_iface.CoreAPI, opts *iface.CreateEntryOptions, io iface.IO) (cid.Cid, error) {
407+
func ToMultihashWithIO(ctx context.Context, e iface.IPFSLogEntry, ipfsInstance coreiface.CoreAPI, opts *iface.CreateEntryOptions, io iface.IO) (cid.Cid, error) {
408408
if opts == nil {
409409
opts = &iface.CreateEntryOptions{}
410410
}
@@ -468,7 +468,7 @@ func Normalize(e iface.IPFSLogEntry, opts *normalizeEntryOpts) *Entry {
468468
}
469469

470470
// FromMultihash creates an Entry from a hash.
471-
func FromMultihash(ctx context.Context, ipfs core_iface.CoreAPI, hash cid.Cid, provider identityprovider.Interface) (iface.IPFSLogEntry, error) {
471+
func FromMultihash(ctx context.Context, ipfs coreiface.CoreAPI, hash cid.Cid, provider identityprovider.Interface) (iface.IPFSLogEntry, error) {
472472
io, err := cbor.IO(&Entry{}, &LamportClock{})
473473
if err != nil {
474474
return nil, err
@@ -478,7 +478,7 @@ func FromMultihash(ctx context.Context, ipfs core_iface.CoreAPI, hash cid.Cid, p
478478
}
479479

480480
// FromMultihashWithIO creates an Entry from a hash.
481-
func FromMultihashWithIO(ctx context.Context, ipfs core_iface.CoreAPI, hash cid.Cid, provider identityprovider.Interface, io iface.IO) (iface.IPFSLogEntry, error) {
481+
func FromMultihashWithIO(ctx context.Context, ipfs coreiface.CoreAPI, hash cid.Cid, provider identityprovider.Interface, io iface.IO) (iface.IPFSLogEntry, error) {
482482
if ipfs == nil {
483483
return nil, errmsg.ErrIPFSNotDefined
484484
}

entry/entry_io.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55

66
"github.com/ipfs/go-cid"
7-
core_iface "github.com/ipfs/interface-go-ipfs-core"
7+
coreiface "github.com/ipfs/kubo/core/coreiface"
88

99
"berty.tech/go-ipfs-log/iface"
1010
)
@@ -13,13 +13,13 @@ type FetchOptions = iface.FetchOptions
1313

1414
// FetchParallel has the same comportement than FetchAll, we keep it for retrop
1515
// compatibility purpose
16-
func FetchParallel(ctx context.Context, ipfs core_iface.CoreAPI, hashes []cid.Cid, options *FetchOptions) []iface.IPFSLogEntry {
16+
func FetchParallel(ctx context.Context, ipfs coreiface.CoreAPI, hashes []cid.Cid, options *FetchOptions) []iface.IPFSLogEntry {
1717
fetcher := NewFetcher(ipfs, options)
1818
return fetcher.Fetch(ctx, hashes)
1919
}
2020

2121
// FetchAll gets entries from their CIDs.
22-
func FetchAll(ctx context.Context, ipfs core_iface.CoreAPI, hashes []cid.Cid, options *FetchOptions) []iface.IPFSLogEntry {
22+
func FetchAll(ctx context.Context, ipfs coreiface.CoreAPI, hashes []cid.Cid, options *FetchOptions) []iface.IPFSLogEntry {
2323
fetcher := NewFetcher(ipfs, options)
2424
return fetcher.Fetch(ctx, hashes)
2525
}

entry/fetcher.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"berty.tech/go-ipfs-log/iface"
1010
"berty.tech/go-ipfs-log/io/cbor"
1111
"github.com/ipfs/go-cid"
12-
core_iface "github.com/ipfs/interface-go-ipfs-core"
12+
coreiface "github.com/ipfs/kubo/core/coreiface"
1313
"golang.org/x/sync/semaphore"
1414
)
1515

@@ -21,7 +21,7 @@ const (
2121
taskKindDone
2222
)
2323

24-
func noopShouldExclude(hash cid.Cid) bool {
24+
func noopShouldExclude(_ cid.Cid) bool {
2525
return false
2626
}
2727

@@ -39,11 +39,11 @@ type Fetcher struct {
3939
condProcess *sync.Cond
4040
muProcess *sync.RWMutex
4141
sem *semaphore.Weighted
42-
ipfs core_iface.CoreAPI
42+
ipfs coreiface.CoreAPI
4343
progressChan chan iface.IPFSLogEntry
4444
}
4545

46-
func NewFetcher(ipfs core_iface.CoreAPI, options *FetchOptions) *Fetcher {
46+
func NewFetcher(ipfs coreiface.CoreAPI, options *FetchOptions) *Fetcher {
4747
// set default
4848
length := -1
4949
if options.Length != nil {
@@ -117,11 +117,11 @@ func (f *Fetcher) processQueue(ctx context.Context, hashes []cid.Cid) []iface.IP
117117

118118
// run process
119119
go func(hash cid.Cid) {
120-
entry, err := f.fetchEntry(ctx, hash)
121-
if err != nil { // nolint:staticcheck
122-
// @FIXME(gfanton): log this
123-
// fmt.Printf("unable to fetch entry: %s\n", err.Error())
124-
}
120+
entry, _ := f.fetchEntry(ctx, hash)
121+
// if err != nil {
122+
// @FIXME(gfanton): log this
123+
// fmt.Printf("unable to fetch entry: %s\n", err.Error())
124+
// }
125125

126126
// free process slot
127127
f.processDone()
@@ -186,7 +186,7 @@ func (f *Fetcher) processQueue(ctx context.Context, hashes []cid.Cid) []iface.IP
186186
return results
187187
}
188188

189-
func (f *Fetcher) updateClock(ctx context.Context, entry, lastEntry iface.IPFSLogEntry) {
189+
func (f *Fetcher) updateClock(_ context.Context, entry, lastEntry iface.IPFSLogEntry) {
190190
f.muClock.Lock()
191191

192192
ts := entry.GetClock().GetTime()
@@ -222,7 +222,7 @@ func (f *Fetcher) exclude(hash cid.Cid) (yes bool) {
222222
return
223223
}
224224

225-
func (f *Fetcher) addNextEntry(ctx context.Context, queue processQueue, entry iface.IPFSLogEntry, results []iface.IPFSLogEntry) {
225+
func (f *Fetcher) addNextEntry(_ context.Context, queue processQueue, entry iface.IPFSLogEntry, results []iface.IPFSLogEntry) {
226226
ts := entry.GetClock().GetTime()
227227

228228
if f.length < 0 {

example/example_log_append_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,5 @@ func Example_logAppend() {
154154
fmt.Println(res.ToString(nil))
155155

156156
// Output:
157-
// go-libp2p resource manager protection disabled
158-
// go-libp2p resource manager protection disabled
159157
// hello world
160158
}

0 commit comments

Comments
 (0)