Skip to content

Commit

Permalink
lint and bump go 1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
Savid committed Oct 4, 2024
1 parent f8920a6 commit 08e7ce4
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'
go-version: '1.23'
- uses: actions/setup-node@v3
name: Set up Node
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/vet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go_version: [ 1.22.x ]
go_version: [ 1.23.x ]
steps:
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v3
Expand All @@ -24,7 +24,7 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.59
version: v1.60

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand All @@ -48,7 +48,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go_version: [ 1.22.x ]
go_version: [ 1.23.x ]
steps:
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v3
Expand Down
4 changes: 1 addition & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ linters-settings:
- performance
- style
govet:
check-shadowing: true
shadow: true
nolintlint:
require-explanation: true
require-specific: true
Expand All @@ -25,13 +25,11 @@ linters:
- bodyclose
- containedctx
- decorder
- depguard
- dogsled
- durationcheck
- errcheck
- errname
- exportloopref
- goconst
- gocritic
- gocyclo
- gofmt
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/ethpandaops/forky

go 1.22.0

toolchain go1.23.1
go 1.23.1

replace github.com/probe-lab/hermes => github.com/ethpandaops/hermes v0.0.0-20240919054858-186de8ab9894

Expand Down
4 changes: 2 additions & 2 deletions pkg/forky/db/frame_metadata_label.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type FrameMetadataLabels []FrameMetadataLabel
func (f *FrameMetadataLabels) AsStrings() []string {
labels := make([]string, len(*f))

for i, label := range *f {
labels[i] = label.Name
for i := range *f {
labels[i] = (*f)[i].Name
}

return labels
Expand Down
3 changes: 2 additions & 1 deletion pkg/forky/db/indexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ func TestIndexer_ListNodesWithFrames(t *testing.T) {
// Check that all nodes are returned
expectedNodes := []string{"node0", "node1", "node2", "node3", "node4"}
assert.Len(t, nodes, len(expectedNodes))

for _, node := range expectedNodes {
assert.Contains(t, nodes, node)
}
Expand Down Expand Up @@ -682,6 +683,7 @@ func TestIndexer_ListNodesWithFrames(t *testing.T) {
filter := &FrameFilter{
Labels: &[]string{"label5"},
}

nodes, err := indexer.ListNodesWithFrames(context.Background(), filter, &PaginationCursor{})
if err != nil {
t.Fatal(err)
Expand All @@ -690,7 +692,6 @@ func TestIndexer_ListNodesWithFrames(t *testing.T) {
// Check that only nodes with frames with the "label5" label are returned
for _, node := range nodes {
frames, err := indexer.ListFrameMetadata(context.Background(), &FrameFilter{
//nolint:gosec // don't care in this test
Node: &node,
}, &PaginationCursor{})
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/forky/forky_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ func TestForkChoiceServer(t *testing.T) {
}

time.Sleep(5 * time.Second)

err = s.svc.DeleteOldFrames(context.Background())
assert.NoError(t, err)

Expand Down
8 changes: 4 additions & 4 deletions pkg/forky/source/xatu_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func (x *XatuHTTP) handleXatuEvent(ctx context.Context, event *xatu.DecoratedEve

func (x *XatuHTTP) handleForkChoiceEvent(ctx context.Context, event *xatu.DecoratedEvent) error {
// Create a new frame based on the event
fc := event.GetEthV1ForkChoice()
fc := event.GetEthV1ForkChoiceV2()
if fc == nil {
return fmt.Errorf("event is not a fork choice event")
}
Expand Down Expand Up @@ -337,7 +337,7 @@ func (x *XatuHTTP) handleForkChoiceReorgEvent(ctx context.Context, event *xatu.D

// Create 2 new frames based on the event (one for `before` the reorg and one for `after` the reorg)
// Note: `before` can be nil if the reorg happened before the xatu sentry started
fcr := event.GetEthV1ForkChoiceReorg()
fcr := event.GetEthV1ForkChoiceReorgV2()
if fcr == nil {
return fmt.Errorf("event is not a fork choice reorg event")
}
Expand Down Expand Up @@ -453,7 +453,7 @@ func (x *XatuHTTP) createFrameFromSnapshotAndData(ctx context.Context,
}

if event.GetEvent().GetName() == xatu.Event_BEACON_API_ETH_V1_DEBUG_FORK_CHOICE_REORG {
data := event.GetEthV1ForkChoiceReorg()
data := event.GetEthV1ForkChoiceReorgV2()

prefix := "xatu_reorg_event_"

Expand All @@ -466,7 +466,7 @@ func (x *XatuHTTP) createFrameFromSnapshotAndData(ctx context.Context,
prefix+"old_head_state="+data.GetEvent().GetOldHeadState(),
prefix+"new_head_block="+data.GetEvent().GetNewHeadBlock(),
prefix+"new_head_state="+data.GetEvent().GetNewHeadState(),
fmt.Sprintf(prefix+"depth=%d", +data.GetEvent().GetDepth()),
fmt.Sprintf(prefix+"depth=%d", +data.GetEvent().GetDepth().GetValue()),

"xatu_reorg_frame_timing="+timing,
)
Expand Down

0 comments on commit 08e7ce4

Please sign in to comment.