Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit 7f18df8

Browse files
committed
fix: make PinsOfType take a context
We haven't bothered changing existing functions to reduce breaking changes, but we might as well add contexts to new functions.
1 parent 59fb584 commit 7f18df8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

shell.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ func (s *Shell) Pins() (map[string]PinInfo, error) {
240240
}
241241

242242
// Pins returns a map of the pins of specified type (DirectPin, RecursivePin, or IndirectPin)
243-
func (s *Shell) PinsOfType(pinType PinType) (map[string]PinInfo, error) {
243+
func (s *Shell) PinsOfType(ctx context.Context, pinType PinType) (map[string]PinInfo, error) {
244244
var raw struct{ Keys map[string]PinInfo }
245-
return raw.Keys, s.Request("pin/ls").Option("type", pinType).Exec(context.Background(), &raw)
245+
return raw.Keys, s.Request("pin/ls").Option("type", pinType).Exec(ctx, &raw)
246246
}
247247

248248
// PinStreamInfo is the output type for PinsStream

shell_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func TestPinsOfType(t *testing.T) {
247247
h, err := s.Add(bytes.NewBufferString("go-ipfs-api pins test 9F3D1F30-D12A-4024-9477-8F0C8E4B3A63"))
248248
is.Nil(err)
249249

250-
pins, err := s.PinsOfType(RecursivePin)
250+
pins, err := s.PinsOfType(context.Background(), RecursivePin)
251251
is.Nil(err)
252252

253253
_, ok := pins[h]

0 commit comments

Comments
 (0)