Skip to content

Commit

Permalink
rename interface{} to any.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Apr 12, 2023
1 parent ec3f128 commit 326d279
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions connection.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package nostr

import (
"github.com/gorilla/websocket"
"sync"

"github.com/gorilla/websocket"
)

type Connection struct {
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 326d279

Please sign in to comment.