Skip to content

Commit

Permalink
Remove unnecessary String() calls with stringer interface (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
sejongk authored Jan 29, 2024
1 parent 0a7f4c8 commit 0cdb329
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
14 changes: 7 additions & 7 deletions server/backend/database/memory/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ func (d *DB) UpdateAndFindMinSyncedTicket(
time.InitialActorID.String(),
)
if err != nil {
return nil, fmt.Errorf("fetch smallest syncedseq of %s: %w", docRefKey.DocID.String(), err)
return nil, fmt.Errorf("fetch smallest syncedseq of %s: %w", docRefKey.DocID, err)
}

var syncedSeqInfo *database.SyncedSeqInfo
Expand Down Expand Up @@ -1192,7 +1192,7 @@ func (d *DB) UpdateSyncedSeq(
docRefKey.DocID.String(),
clientInfo.ID.String(),
); err != nil {
return fmt.Errorf("delete syncedseqs of %s: %w", docRefKey.DocID.String(), err)
return fmt.Errorf("delete syncedseqs of %s: %w", docRefKey.DocID, err)
}
txn.Commit()
return nil
Expand All @@ -1210,7 +1210,7 @@ func (d *DB) UpdateSyncedSeq(
clientInfo.ID.String(),
)
if err != nil {
return fmt.Errorf("fetch syncedseqs of %s: %w", docRefKey.DocID.String(), err)
return fmt.Errorf("fetch syncedseqs of %s: %w", docRefKey.DocID, err)
}

syncedSeqInfo := &database.SyncedSeqInfo{
Expand All @@ -1228,7 +1228,7 @@ func (d *DB) UpdateSyncedSeq(
}

if err := txn.Insert(tblSyncedSeqs, syncedSeqInfo); err != nil {
return fmt.Errorf("insert syncedseqs of %s: %w", docRefKey.DocID.String(), err)
return fmt.Errorf("insert syncedseqs of %s: %w", docRefKey.DocID, err)
}

txn.Commit()
Expand Down Expand Up @@ -1267,7 +1267,7 @@ func (d *DB) FindDocInfosByPaging(
)
}
if err != nil {
return nil, fmt.Errorf("fetch documents of %s: %w", projectID.String(), err)
return nil, fmt.Errorf("fetch documents of %s: %w", projectID, err)
}

var docInfos []*database.DocInfo
Expand Down Expand Up @@ -1366,12 +1366,12 @@ func (d *DB) findTicketByServerSeq(
serverSeq,
)
if err != nil {
return nil, fmt.Errorf("fetch change of %s: %w", docRefKey.DocID.String(), err)
return nil, fmt.Errorf("fetch change of %s: %w", docRefKey.DocID, err)
}
if raw == nil {
return nil, fmt.Errorf(
"docID %s, serverSeq %d: %w",
docRefKey.DocID.String(),
docRefKey.DocID,
serverSeq,
database.ErrDocumentNotFound,
)
Expand Down
18 changes: 9 additions & 9 deletions server/backend/sync/memory/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (m *PubSub) Subscribe(
logging.From(ctx).Debugf(
`Subscribe(%s,%s) End`,
documentRefKey,
subscriber.String(),
subscriber,
)
}
return sub, nil
Expand All @@ -123,7 +123,7 @@ func (m *PubSub) Unsubscribe(
logging.From(ctx).Debugf(
`Unsubscribe(%s,%s) Start`,
documentRefKey,
sub.Subscriber().String(),
sub.Subscriber(),
)
}

Expand All @@ -141,7 +141,7 @@ func (m *PubSub) Unsubscribe(
logging.From(ctx).Debugf(
`Unsubscribe(%s,%s) End`,
documentRefKey,
sub.Subscriber().String(),
sub.Subscriber(),
)
}
}
Expand All @@ -159,7 +159,7 @@ func (m *PubSub) Publish(
if logging.Enabled(zap.DebugLevel) {
logging.From(ctx).Debugf(`Publish(%s,%s) Start`,
documentRefKey,
publisherID.String())
publisherID)
}

if subs, ok := m.subscriptionsMapByDocRefKey[documentRefKey]; ok {
Expand All @@ -173,8 +173,8 @@ func (m *PubSub) Publish(
`Publish %s(%s,%s) to %s`,
event.Type,
documentRefKey,
publisherID.String(),
sub.Subscriber().String(),
publisherID,
sub.Subscriber(),
)
}

Expand All @@ -186,16 +186,16 @@ func (m *PubSub) Publish(
logging.From(ctx).Warnf(
`Publish(%s,%s) to %s timeout`,
documentRefKey,
publisherID.String(),
sub.Subscriber().String(),
publisherID,
sub.Subscriber(),
)
}
}
}
if logging.Enabled(zap.DebugLevel) {
logging.From(ctx).Debugf(`Publish(%s,%s) End`,
documentRefKey,
publisherID.String())
publisherID)
}
}

Expand Down
6 changes: 3 additions & 3 deletions server/packs/pushpull.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func pushChanges(
len(reqPack.Changes)-len(pushedChanges),
initialServerSeq,
docInfo.ServerSeq,
cp.String(),
cp,
)
}

Expand Down Expand Up @@ -168,7 +168,7 @@ func pullSnapshot(
reqPack.Checkpoint.ServerSeq+1,
initialServerSeq,
docInfo.Key,
cpAfterPull.String(),
cpAfterPull,
)

return NewServerPack(docInfo.Key, cpAfterPull, nil, snapshot), err
Expand Down Expand Up @@ -218,7 +218,7 @@ func pullChangeInfos(
pulledChanges[0].ServerSeq,
pulledChanges[len(pulledChanges)-1].ServerSeq,
docInfo.Key,
cpAfterPull.String(),
cpAfterPull,
len(filteredChanges),
)
}
Expand Down
2 changes: 1 addition & 1 deletion server/rpc/yorkie_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func (s *yorkieServer) WatchDocument(

locker, err := s.backend.Coordinator.NewLocker(
ctx,
sync.NewKey(fmt.Sprintf("watchdoc-%s-%s", clientID.String(), docID)),
sync.NewKey(fmt.Sprintf("watchdoc-%s-%s", clientID, docID)),
)
if err != nil {
return err
Expand Down

0 comments on commit 0cdb329

Please sign in to comment.