rename interface{} to any.

This commit is contained in:
fiatjaf 2023-04-12 12:14:24 -03:00
parent ec3f1287c4
commit 326d2790de
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
4 changed files with 6 additions and 5 deletions

View File

@ -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)

View File

@ -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"

View File

@ -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)
}

View File

@ -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) {