1
0
Fork 0
mirror of https://github.com/fluffle/goirc synced 2025-05-12 18:44:50 +00:00

Run gofmt over code, it's been a while.

This commit is contained in:
Alex Bramley 2011-09-12 23:25:09 +01:00
parent 18c20080e8
commit c400a2141a
7 changed files with 53 additions and 54 deletions

View file

@ -8,6 +8,7 @@ import (
)
type HandlerID uint32
var hidCounter uint32 = 0
func NewHandlerID() HandlerID {
@ -20,8 +21,8 @@ type Handler interface {
}
type basicHandler struct {
fn func(...interface{})
id HandlerID
fn func(...interface{})
id HandlerID
}
func (h *basicHandler) Run(ev ...interface{}) {
@ -37,7 +38,7 @@ func NewHandler(h func(...interface{})) Handler {
}
type EventDispatcher interface {
Dispatch(name string, ev...interface{})
Dispatch(name string, ev ...interface{})
}
type EventRegistry interface {
@ -50,9 +51,9 @@ type EventRegistry interface {
type registry struct {
// Event registry as a lockable map of linked-lists
sync.RWMutex
events map[string]*list.List
events map[string]*list.List
dispatcher func(r *registry, name string, ev ...interface{})
}
}
func NewRegistry() EventRegistry {
r := &registry{events: make(map[string]*list.List)}

View file

@ -10,7 +10,7 @@ import (
func TestSimpleDispatch(t *testing.T) {
r := NewRegistry()
out := make(chan bool)
h := NewHandler(func(ev ...interface{}) {
out <- ev[0].(bool)
})
@ -41,7 +41,7 @@ func TestParallelDispatch(t *testing.T) {
}
// create some handlers and send an event to them
for _, t := range []int{5,11,2,15,8} {
for _, t := range []int{5, 11, 2, 15, 8} {
r.AddHandler("send", factory(t))
}
r.Dispatch("send")
@ -79,7 +79,7 @@ func TestSerialDispatch(t *testing.T) {
}
// create some handlers and send an event to them
for _, t := range []int{5,11,2,15,8} {
for _, t := range []int{5, 11, 2, 15, 8} {
r.AddHandler("send", factory(t))
}
r.Dispatch("send")
@ -101,4 +101,3 @@ func TestSerialDispatch(t *testing.T) {
t.Fail()
}
}