Skip to content

Commit 706d90d

Browse files
authored
Merge pull request #321 from spacemeshos/update-go-1.24
Update go to 1.24
2 parents f2dd1bb + 5fd67cd commit 706d90d

File tree

13 files changed

+483
-187
lines changed

13 files changed

+483
-187
lines changed

.golangci.yml

Lines changed: 419 additions & 119 deletions
Large diffs are not rendered by default.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23 AS builder
1+
FROM golang:1.24 AS builder
22
RUN set -ex \
33
&& apt-get update --fix-missing \
44
&& apt-get install -qy --no-install-recommends \

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ else
99
ULIMIT := ulimit -n 4096;
1010
endif
1111

12-
GOLANGCI_LINT_VERSION := v1.61.0
12+
GOLANGCI_LINT_VERSION := v1.64.6
1313
GOTESTSUM_VERSION := v1.12.0
1414
MOCKGEN_VERSION := v0.5.0
1515

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/spacemeshos/post
22

3-
go 1.23.2
3+
go 1.24.1
44

55
require (
66
github.com/davecgh/go-spew v1.1.1

initialization/initialization_test.go

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TestInitialize(t *testing.T) {
5656
require.NoError(t, err)
5757

5858
{
59-
ctx, cancel := context.WithCancel(context.Background())
59+
ctx, cancel := context.WithCancel(t.Context())
6060
defer cancel()
6161

6262
var eg errgroup.Group
@@ -105,7 +105,7 @@ func TestInitialize_NotStuck_If_No_Nonce_found(t *testing.T) {
105105
require.NoError(t, err)
106106

107107
{
108-
ctx, cancel := context.WithCancel(context.Background())
108+
ctx, cancel := context.WithCancel(t.Context())
109109
defer cancel()
110110
require.NoError(t, init.Initialize(ctx))
111111
}
@@ -132,7 +132,7 @@ func TestInitialize_BeforeNonceValue(t *testing.T) {
132132
)
133133
require.NoError(t, err)
134134

135-
ctx, cancel := context.WithCancel(context.Background())
135+
ctx, cancel := context.WithCancel(t.Context())
136136
defer cancel()
137137
require.NoError(t, init.Initialize(ctx))
138138
cancel()
@@ -189,7 +189,7 @@ func TestInitialize_PowOutOfRange(t *testing.T) {
189189
)
190190
r.NoError(err)
191191

192-
r.NoError(init.Initialize(context.Background()))
192+
r.NoError(init.Initialize(t.Context()))
193193
r.Equal(uint64(opts.NumUnits)*cfg.LabelsPerUnit, init.NumLabelsWritten())
194194

195195
m := &shared.VRFNonceMetadata{
@@ -218,7 +218,7 @@ func TestInitialize_ContinueWithLastPos(t *testing.T) {
218218
)
219219
r.NoError(err)
220220

221-
r.NoError(init.Initialize(context.Background()))
221+
r.NoError(init.Initialize(t.Context()))
222222
r.Equal(uint64(opts.NumUnits)*cfg.LabelsPerUnit, init.NumLabelsWritten())
223223

224224
meta := &shared.VRFNonceMetadata{
@@ -241,7 +241,7 @@ func TestInitialize_ContinueWithLastPos(t *testing.T) {
241241
)
242242
r.NoError(err)
243243

244-
r.NoError(init.Initialize(context.Background()))
244+
r.NoError(init.Initialize(t.Context()))
245245
r.Equal(uint64(opts.NumUnits)*cfg.LabelsPerUnit, init.NumLabelsWritten())
246246

247247
m, err := LoadMetadata(opts.DataDir)
@@ -264,7 +264,7 @@ func TestInitialize_ContinueWithLastPos(t *testing.T) {
264264
)
265265
r.NoError(err)
266266

267-
r.NoError(init.Initialize(context.Background()))
267+
r.NoError(init.Initialize(t.Context()))
268268
r.Equal(uint64(opts.NumUnits)*cfg.LabelsPerUnit, init.NumLabelsWritten())
269269

270270
m, err = LoadMetadata(opts.DataDir)
@@ -288,7 +288,7 @@ func TestInitialize_ContinueWithLastPos(t *testing.T) {
288288
)
289289
r.NoError(err)
290290

291-
r.NoError(init.Initialize(context.Background()))
291+
r.NoError(init.Initialize(t.Context()))
292292
r.Equal(uint64(opts.NumUnits)*cfg.LabelsPerUnit, init.NumLabelsWritten())
293293

294294
m, err = LoadMetadata(opts.DataDir)
@@ -322,7 +322,7 @@ func TestInitialize_ContinueWithLastPos(t *testing.T) {
322322
)
323323
r.NoError(err)
324324

325-
r.NoError(init.Initialize(context.Background()))
325+
r.NoError(init.Initialize(t.Context()))
326326
r.Equal(uint64(opts.NumUnits)*cfg.LabelsPerUnit, init.NumLabelsWritten())
327327

328328
m, err = LoadMetadata(opts.DataDir)
@@ -365,7 +365,7 @@ func TestReset_WhileInitializing(t *testing.T) {
365365
r.ErrorIs(init.Reset(), ErrCannotResetWhileInitializing)
366366
return nil
367367
})
368-
eg.Go(func() error { return init.Initialize(context.Background()) })
368+
eg.Go(func() error { return init.Initialize(t.Context()) })
369369
eg.Wait()
370370

371371
r.NoError(init.Reset())
@@ -387,7 +387,7 @@ func TestInitialize_Repeated(t *testing.T) {
387387
r.NoError(err)
388388

389389
{
390-
ctx, cancel := context.WithCancel(context.Background())
390+
ctx, cancel := context.WithCancel(t.Context())
391391
defer cancel()
392392

393393
var eg errgroup.Group
@@ -408,7 +408,7 @@ func TestInitialize_Repeated(t *testing.T) {
408408
r.NoError(err)
409409

410410
{
411-
ctx, cancel := context.WithCancel(context.Background())
411+
ctx, cancel := context.WithCancel(t.Context())
412412
defer cancel()
413413

414414
var eg errgroup.Group
@@ -436,7 +436,7 @@ func TestInitialize_NumUnits_Increase(t *testing.T) {
436436
r.NoError(err)
437437

438438
{
439-
ctx, cancel := context.WithCancel(context.Background())
439+
ctx, cancel := context.WithCancel(t.Context())
440440
defer cancel()
441441

442442
var eg errgroup.Group
@@ -458,7 +458,7 @@ func TestInitialize_NumUnits_Increase(t *testing.T) {
458458
r.NoError(err)
459459

460460
{
461-
ctx, cancel := context.WithCancel(context.Background())
461+
ctx, cancel := context.WithCancel(t.Context())
462462
defer cancel()
463463

464464
var eg errgroup.Group
@@ -485,7 +485,7 @@ func TestInitialize_NumUnits_Decrease(t *testing.T) {
485485
r.NoError(err)
486486

487487
{
488-
ctx, cancel := context.WithCancel(context.Background())
488+
ctx, cancel := context.WithCancel(t.Context())
489489
defer cancel()
490490

491491
var eg errgroup.Group
@@ -507,7 +507,7 @@ func TestInitialize_NumUnits_Decrease(t *testing.T) {
507507
r.NoError(err)
508508

509509
{
510-
ctx, cancel := context.WithCancel(context.Background())
510+
ctx, cancel := context.WithCancel(t.Context())
511511
defer cancel()
512512

513513
var eg errgroup.Group
@@ -535,7 +535,7 @@ func TestInitialize_RedundantFiles(t *testing.T) {
535535
r.NoError(err)
536536

537537
{
538-
ctx, cancel := context.WithCancel(context.Background())
538+
ctx, cancel := context.WithCancel(t.Context())
539539
defer cancel()
540540

541541
var eg errgroup.Group
@@ -558,7 +558,7 @@ func TestInitialize_RedundantFiles(t *testing.T) {
558558
r.NoError(err)
559559

560560
{
561-
ctx, cancel := context.WithCancel(context.Background())
561+
ctx, cancel := context.WithCancel(t.Context())
562562
defer cancel()
563563

564564
var eg errgroup.Group
@@ -602,7 +602,7 @@ func TestInitialize_MultipleFiles(t *testing.T) {
602602
WithLogger(zaptest.NewLogger(t, zaptest.Level(zap.DebugLevel))),
603603
)
604604
require.NoError(t, err)
605-
require.NoError(t, init.Initialize(context.Background()))
605+
require.NoError(t, init.Initialize(t.Context()))
606606

607607
oneFileData, err = initData(opts.DataDir)
608608
require.NoError(t, err)
@@ -636,7 +636,7 @@ func TestInitialize_MultipleFiles(t *testing.T) {
636636
WithLogger(zaptest.NewLogger(t, zaptest.Level(zap.DebugLevel))),
637637
)
638638
require.NoError(t, err)
639-
require.NoError(t, init.Initialize(context.Background()))
639+
require.NoError(t, init.Initialize(t.Context()))
640640

641641
multipleFilesData, err := initData(opts.DataDir)
642642
require.NoError(t, err)
@@ -676,13 +676,13 @@ func TestNumLabelsWritten(t *testing.T) {
676676
r.Equal(uint64(0), numLabelsWritten)
677677

678678
// Initialize.
679-
r.NoError(init.Initialize(context.Background()))
679+
r.NoError(init.Initialize(t.Context()))
680680
numLabelsWritten, err = init.diskState.NumLabelsWritten()
681681
r.NoError(err)
682682
r.Equal(uint64(opts.NumUnits)*cfg.LabelsPerUnit, numLabelsWritten)
683683

684684
// Initialize repeated.
685-
r.NoError(init.Initialize(context.Background()))
685+
r.NoError(init.Initialize(t.Context()))
686686
numLabelsWritten, err = init.diskState.NumLabelsWritten()
687687
r.NoError(err)
688688
r.Equal(uint64(opts.NumUnits)*cfg.LabelsPerUnit, numLabelsWritten)
@@ -699,7 +699,7 @@ func TestNumLabelsWritten(t *testing.T) {
699699
numLabelsWritten, err = init.diskState.NumLabelsWritten()
700700
r.NoError(err)
701701
r.Equal(uint64(opts.NumUnits)*cfg.LabelsPerUnit, numLabelsWritten)
702-
r.NoError(init.Initialize(context.Background()))
702+
r.NoError(init.Initialize(t.Context()))
703703
numLabelsWritten, err = init.diskState.NumLabelsWritten()
704704
r.NoError(err)
705705
r.Equal(uint64(opts.NumUnits)*cfg.LabelsPerUnit, numLabelsWritten)
@@ -723,7 +723,7 @@ func TestValidateMetadata(t *testing.T) {
723723
r.NoError(err)
724724
r.NoError(init.verifyMetadata(m))
725725

726-
r.NoError(init.Initialize(context.Background()))
726+
r.NoError(init.Initialize(t.Context()))
727727
m, err = init.loadMetadata()
728728
r.NoError(err)
729729
r.NoError(init.verifyMetadata(m))
@@ -802,7 +802,7 @@ func TestStop(t *testing.T) {
802802

803803
// Start initialization and stop it after it has written some labels
804804
{
805-
ctx, cancel := context.WithCancel(context.Background())
805+
ctx, cancel := context.WithCancel(t.Context())
806806
defer cancel()
807807

808808
var eg errgroup.Group
@@ -819,7 +819,7 @@ func TestStop(t *testing.T) {
819819

820820
// Continue the initialization to completion.
821821
{
822-
ctx, cancel := context.WithCancel(context.Background())
822+
ctx, cancel := context.WithCancel(t.Context())
823823
defer cancel()
824824

825825
var eg errgroup.Group
@@ -878,7 +878,7 @@ func TestWrongLabelsDetected(t *testing.T) {
878878
)
879879
require.NoError(t, err)
880880

881-
err = init.Initialize(context.Background())
881+
err = init.Initialize(t.Context())
882882

883883
var errWrongLabels ErrReferenceLabelMismatch
884884
require.ErrorAs(t, err, &errWrongLabels)
@@ -908,7 +908,7 @@ func TestMissingProviderErrorsOnInitialize(t *testing.T) {
908908
)
909909
require.NoError(t, err) // no error on missing provider
910910

911-
err = init.Initialize(context.Background())
911+
err = init.Initialize(t.Context())
912912
require.ErrorContains(t, err, "no provider specified")
913913
}
914914

@@ -926,7 +926,7 @@ func TestMissingProviderNoErrorWithFinishedInitialization(t *testing.T) {
926926
)
927927
require.NoError(t, err)
928928

929-
err = init.Initialize(context.Background())
929+
err = init.Initialize(t.Context())
930930
require.NoError(t, err)
931931

932932
opts.ProviderID = nil
@@ -939,7 +939,7 @@ func TestMissingProviderNoErrorWithFinishedInitialization(t *testing.T) {
939939
)
940940
require.NoError(t, err)
941941

942-
err = init.Initialize(context.Background())
942+
err = init.Initialize(t.Context())
943943
require.NoError(t, err) // no error on missing provider because init is finished already
944944
}
945945

@@ -986,7 +986,7 @@ func TestInitializeSubset(t *testing.T) {
986986
WithLogger(zaptest.NewLogger(t, zaptest.Level(zap.DebugLevel))),
987987
)
988988
require.NoError(t, err)
989-
err = init.Initialize(context.Background())
989+
err = init.Initialize(t.Context())
990990
require.NoError(t, err)
991991

992992
optsSubset := opts
@@ -1003,7 +1003,7 @@ func TestInitializeSubset(t *testing.T) {
10031003
WithLogger(zaptest.NewLogger(t, zaptest.Level(zap.DebugLevel))),
10041004
)
10051005
require.NoError(t, err)
1006-
require.NoError(t, initSubset.Initialize(context.Background()))
1006+
require.NoError(t, initSubset.Initialize(t.Context()))
10071007

10081008
// Verify that the subset is a subset of the full set
10091009
fullData, err := initData(opts.DataDir)
@@ -1067,7 +1067,7 @@ func TestInitializeSubset_NoNonce(t *testing.T) {
10671067
}),
10681068
)
10691069
require.NoError(t, err)
1070-
require.NoError(t, init.Initialize(context.Background()))
1070+
require.NoError(t, init.Initialize(t.Context()))
10711071

10721072
// no nonce is found when initializing a subset
10731073
require.Nil(t, init.Nonce())
@@ -1097,7 +1097,7 @@ func TestInitializeSubset_NoNonce(t *testing.T) {
10971097
}),
10981098
)
10991099
require.NoError(t, err)
1100-
require.NoError(t, init.Initialize(context.Background()))
1100+
require.NoError(t, init.Initialize(t.Context()))
11011101

11021102
require.NotNil(t, init.Nonce())
11031103
require.NotNil(t, init.NonceValue())
@@ -1126,7 +1126,7 @@ func TestInitializeLastFileIsSmaller(t *testing.T) {
11261126
WithLogger(zaptest.NewLogger(t, zaptest.Level(zap.DebugLevel))),
11271127
)
11281128
require.NoError(t, err)
1129-
err = init.Initialize(context.Background())
1129+
err = init.Initialize(t.Context())
11301130
require.NoError(t, err)
11311131

11321132
// Verify that the first file contains 2 units

initialization/pos_verification_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package initialization
22

33
import (
4-
"context"
54
"os"
65
"testing"
76

@@ -25,7 +24,7 @@ func TestVerifyPos(t *testing.T) {
2524
WithLogger(zaptest.NewLogger(t, zaptest.Level(zap.DebugLevel))),
2625
)
2726
require.NoError(t, err)
28-
err = init.Initialize(context.Background())
27+
err = init.Initialize(t.Context())
2928
require.NoError(t, err)
3029

3130
scryptParams := postrs.NewScryptParams(opts.Scrypt.N, opts.Scrypt.R, opts.Scrypt.P)

0 commit comments

Comments
 (0)