diff --git a/connection.go b/connection.go index 50c81fd..b3dd52e 100644 --- a/connection.go +++ b/connection.go @@ -1,8 +1,9 @@ package nostr import ( - "github.com/gorilla/websocket" "sync" + + "github.com/gorilla/websocket" ) type Connection struct { @@ -16,7 +17,7 @@ func NewConnection(socket *websocket.Conn) *Connection { } } -func (c *Connection) WriteJSON(v interface{}) error { +func (c *Connection) WriteJSON(v any) error { c.mutex.Lock() defer c.mutex.Unlock() return c.socket.WriteJSON(v) diff --git a/relay.go b/relay.go index 6d7d08d..00c8253 100644 --- a/relay.go +++ b/relay.go @@ -381,7 +381,7 @@ func (r *Relay) Auth(ctx context.Context, event Event) (Status, error) { defer r.okCallbacks.Delete(event.ID) // send AUTH - authResponse := []interface{}{"AUTH", event} + authResponse := []any{"AUTH", event} debugLog("{%s} sending %v\n", r.URL, authResponse) if err := r.Connection.WriteJSON(authResponse); err != nil { // status will be "failed" diff --git a/subscription.go b/subscription.go index 3e4f251..c69cf69 100644 --- a/subscription.go +++ b/subscription.go @@ -66,7 +66,7 @@ func (sub *Subscription) Sub(ctx context.Context, filters Filters) { func (sub *Subscription) Fire() error { sub.Relay.subscriptions.Store(sub.GetID(), sub) - message := []interface{}{"REQ", sub.GetID()} + message := []any{"REQ", sub.GetID()} for _, filter := range sub.Filters { message = append(message, filter) } diff --git a/tags.go b/tags.go index f1d1c09..b3b8d585 100644 --- a/tags.go +++ b/tags.go @@ -114,7 +114,7 @@ func (tags Tags) AppendUnique(tag Tag) Tags { } } -func (t *Tags) Scan(src interface{}) error { +func (t *Tags) Scan(src any) error { var jtags []byte = make([]byte, 0) switch v := src.(type) {