Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions p2p/host/eventbus/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
w.closeOnce.Do(func() {
w.w.removeSink(w.ch)
if w.metricsTracer != nil {
w.metricsTracer.RemoveSubscriber(reflect.TypeOf(event.WildcardSubscription))
w.metricsTracer.RemoveSubscriber(reflect.TypeFor[*event.wildcardSubscriptionType]())

Check failure on line 136 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go 1.25.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 136 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go 1.24.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 136 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / macos (go 1.25.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 136 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / macos (go 1.24.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 136 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / windows (go 1.24.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 136 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / windows (go 1.25.x)

name wildcardSubscriptionType not exported by package event
}
})

Expand Down Expand Up @@ -345,7 +345,7 @@
n.Unlock()

if n.metricsTracer != nil {
n.metricsTracer.AddSubscriber(reflect.TypeOf(event.WildcardSubscription))
n.metricsTracer.AddSubscriber(reflect.TypeFor[*event.wildcardSubscriptionType]())

Check failure on line 348 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go 1.25.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 348 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go 1.24.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 348 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / macos (go 1.25.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 348 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / macos (go 1.24.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 348 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / windows (go 1.24.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 348 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / windows (go 1.25.x)

name wildcardSubscriptionType not exported by package event
}
}

Expand All @@ -368,7 +368,7 @@
n.Unlock()
}

var wildcardType = reflect.TypeOf(event.WildcardSubscription)
var wildcardType = reflect.TypeFor[*event.wildcardSubscriptionType]()

Check failure on line 371 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go 1.25.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 371 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go 1.24.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 371 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / macos (go 1.25.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 371 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / macos (go 1.24.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 371 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / windows (go 1.24.x)

name wildcardSubscriptionType not exported by package event

Check failure on line 371 in p2p/host/eventbus/basic.go

View workflow job for this annotation

GitHub Actions / go-test / windows (go 1.25.x)

name wildcardSubscriptionType not exported by package event

func (n *wildcardNode) emit(evt interface{}) {
if n.nSinks.Load() == 0 {
Expand Down
6 changes: 3 additions & 3 deletions p2p/host/eventbus/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ func TestGetAllEventTypes(t *testing.T) {

evts := bus.GetAllEventTypes()
require.Len(t, evts, 1)
require.Equal(t, reflect.TypeOf((*EventB)(nil)).Elem(), evts[0])
require.Equal(t, reflect.TypeFor[EventB](), evts[0])

_, err = bus.Emitter(new(EventA))
require.NoError(t, err)

evts = bus.GetAllEventTypes()
require.Len(t, evts, 2)
require.Contains(t, evts, reflect.TypeOf((*EventB)(nil)).Elem())
require.Contains(t, evts, reflect.TypeOf((*EventA)(nil)).Elem())
require.Contains(t, evts, reflect.TypeFor[EventB]())
require.Contains(t, evts, reflect.TypeFor[EventA]())
}

func TestEmitNoSubNoBlock(t *testing.T) {
Expand Down
Loading