Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 10 additions & 10 deletions go/avatars/fullcaching.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ type FullCachingSource struct {

prepareDirs sync.Once

usersMissBatch func(interface{})
teamsMissBatch func(interface{})
usersStaleBatch func(interface{})
teamsStaleBatch func(interface{})
usersMissBatch func(any)
teamsMissBatch func(any)
usersStaleBatch func(any)
teamsStaleBatch func(any)

// testing
populateSuccessCh chan struct{}
Expand All @@ -117,16 +117,16 @@ func NewFullCachingSource(g *libkb.GlobalContext, staleThreshold time.Duration,
staleThreshold: staleThreshold,
simpleSource: NewSimpleSource(),
}
batcher := func(intBatched interface{}, intSingle interface{}) interface{} {
batcher := func(intBatched any, intSingle any) any {
reqs, _ := intBatched.([]remoteFetchArg)
single, _ := intSingle.(remoteFetchArg)
return append(reqs, single)
}
reset := func() interface{} {
reset := func() any {
return []remoteFetchArg{}
}
actor := func(loadFn func(libkb.MetaContext, []string, []keybase1.AvatarFormat) (keybase1.LoadAvatarsRes, error)) func(interface{}) {
return func(intBatched interface{}) {
actor := func(loadFn func(libkb.MetaContext, []string, []keybase1.AvatarFormat) (keybase1.LoadAvatarsRes, error)) func(any) {
return func(intBatched any) {
reqs, _ := intBatched.([]remoteFetchArg)
s.makeRemoteFetchRequests(reqs, loadFn)
}
Expand Down Expand Up @@ -238,7 +238,7 @@ func (c *FullCachingSource) StopBackgroundTasks(mctx libkb.MetaContext) {
}
}

func (c *FullCachingSource) debug(m libkb.MetaContext, msg string, args ...interface{}) {
func (c *FullCachingSource) debug(m libkb.MetaContext, msg string, args ...any) {
m.Debug("Avatars.FullCachingSource: %s", fmt.Sprintf(msg, args...))
}

Expand Down Expand Up @@ -266,7 +266,7 @@ func (c *FullCachingSource) monitorAppState(m libkb.MetaContext) {

func (c *FullCachingSource) processLRUHit(entry lru.DiskLRUEntry) (res lruEntry) {
var ok bool
if _, ok = entry.Value.(map[string]interface{}); ok {
if _, ok = entry.Value.(map[string]any); ok {
jstr, _ := json.Marshal(entry.Value)
_ = json.Unmarshal(jstr, &res)
return res
Expand Down
2 changes: 1 addition & 1 deletion go/avatars/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (s *SimpleSource) makeRes(res *keybase1.LoadAvatarsRes, apiRes apiAvatarRes
return nil
}

func (s *SimpleSource) debug(m libkb.MetaContext, msg string, args ...interface{}) {
func (s *SimpleSource) debug(m libkb.MetaContext, msg string, args ...any) {
m.Debug("Avatars.SimpleSource: %s", fmt.Sprintf(msg, args...))
}

Expand Down
4 changes: 2 additions & 2 deletions go/avatars/srv.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ func (s *Srv) GetUserAvatar(username string) (string, error) {
return fmt.Sprintf("http://%v/av?typ=user&name=%v&format=square_192&token=%v", addr, username, token), nil
}

func (s *Srv) debug(msg string, args ...interface{}) {
func (s *Srv) debug(msg string, args ...any) {
s.G().GetLog().Debug("Avatars.Srv: %s", fmt.Sprintf(msg, args...))
}

func (s *Srv) makeError(w http.ResponseWriter, code int, msg string,
args ...interface{}) {
args ...any) {
s.debug("serve: error code: %d msg %s", code, fmt.Sprintf(msg, args...))
w.WriteHeader(code)
}
Expand Down
2 changes: 1 addition & 1 deletion go/avatars/urlcaching.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (c *URLCachingSource) StopBackgroundTasks(m libkb.MetaContext) {
c.diskLRU.Flush(m.Ctx(), m.G())
}

func (c *URLCachingSource) debug(m libkb.MetaContext, msg string, args ...interface{}) {
func (c *URLCachingSource) debug(m libkb.MetaContext, msg string, args ...any) {
m.Debug("Avatars.URLCachingSource: %s", fmt.Sprintf(msg, args...))
}

Expand Down
4 changes: 2 additions & 2 deletions go/blindtree/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const maxValuesPerLeaf = 1
const keysByteLength = 16

func GetCurrentBlindTreeConfig() (cfg merkletree2.Config) {
valueConstructor := func() interface{} { return BlindMerkleValue{} }
valueConstructor := func() any { return BlindMerkleValue{} }

cfg, err := merkletree2.NewConfig(
encodingType.GetEncoder(),
Expand All @@ -29,7 +29,7 @@ func GetCurrentBlindTreeConfig() (cfg merkletree2.Config) {

// This config uses the non thread safe encoder.
func GetCurrentBlindTreeConfigUnsafe() (cfg merkletree2.Config) {
valueConstructor := func() interface{} { return BlindMerkleValue{} }
valueConstructor := func() any { return BlindMerkleValue{} }

cfg, err := merkletree2.NewConfig(
encodingType.GetUnsafeEncoder(),
Expand Down
2 changes: 1 addition & 1 deletion go/blindtree/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
// appropriate.
type BlindMerkleValue struct {
ValueType BlindMerkleValueType
InnerValue interface{}
InnerValue any
}

// Note: values up to 127 are preferred as they are encoded in a single byte
Expand Down
2 changes: 1 addition & 1 deletion go/blindtree/values_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestEncodeMerkleValues(t *testing.T) {
}

encodingTests := []struct {
Value interface{}
Value any
EncodedValue BlindMerkleValue
Type BlindMerkleValueType
}{
Expand Down
8 changes: 4 additions & 4 deletions go/chat/attachment_httpsrv.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func NewAttachmentHTTPSrv(g *globals.Context, httpSrv *manager.Srv, fetcher type
fetcher: fetcher,
httpSrv: httpSrv,
hmacPool: sync.Pool{
New: func() interface{} {
New: func() any {
return hmac.New(sha256.New, token)
},
},
Expand All @@ -104,7 +104,7 @@ func (r *AttachmentHTTPSrv) GetAttachmentFetcher() types.AttachmentFetcher {
return r.fetcher
}

func (r *AttachmentHTTPSrv) genURLKey(prefix string, payload interface{}) (string, error) {
func (r *AttachmentHTTPSrv) genURLKey(prefix string, payload any) (string, error) {
h := r.hmacPool.Get().(hash.Hash)
defer r.hmacPool.Put(h)
h.Reset()
Expand All @@ -118,7 +118,7 @@ func (r *AttachmentHTTPSrv) genURLKey(prefix string, payload interface{}) (strin
return prefix + hex.EncodeToString(h.Sum(nil)), nil
}

func (r *AttachmentHTTPSrv) getURL(ctx context.Context, prefix string, payload interface{}) string {
func (r *AttachmentHTTPSrv) getURL(ctx context.Context, prefix string, payload any) string {
if !r.httpSrv.Active() {
r.Debug(ctx, "getURL: http server failed to start earlier")
return ""
Expand Down Expand Up @@ -391,7 +391,7 @@ func (r *AttachmentHTTPSrv) serveGiphyLink(ctx context.Context, w http.ResponseW
}

func (r *AttachmentHTTPSrv) makeError(ctx context.Context, w http.ResponseWriter, code int, msg string,
args ...interface{}) {
args ...any) {
r.Debug(ctx, "serve: error code: %d msg %s", code, fmt.Sprintf(msg, args...))
w.WriteHeader(code)
}
Expand Down
2 changes: 1 addition & 1 deletion go/chat/attachments/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func (fi kbfsFileInfo) ModTime() time.Time {
func (fi kbfsFileInfo) IsDir() bool {
return fi.dirent.DirentType == keybase1.DirentType_DIR
}
func (fi kbfsFileInfo) Sys() interface{} { return fi.dirent }
func (fi kbfsFileInfo) Sys() any { return fi.dirent }

// StatOSOrKbfsFile stats the file located at p, using SimpleFSStat if it's a
// KBFS path, or os.Stat if not.
Expand Down
12 changes: 6 additions & 6 deletions go/chat/boxer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ func (b *Boxer) preBoxCheck(ctx context.Context, messagePlaintext chat1.MessageP
if err != nil {
return err
}
e := func(format string, args ...interface{}) error {
e := func(format string, args ...any) error {
return errors.New(fmt.Sprintf("malformed %v message: ", typ) + fmt.Sprintf(format, args...))
}
switch typ {
Expand Down Expand Up @@ -1876,7 +1876,7 @@ func (b *Boxer) boxV2orV3orV4(ctx context.Context, messagePlaintext chat1.Messag
}

// seal encrypts data into chat1.EncryptedData.
func (b *Boxer) seal(data interface{}, key libkb.NaclSecretBoxKey) (*chat1.EncryptedData, error) {
func (b *Boxer) seal(data any, key libkb.NaclSecretBoxKey) (*chat1.EncryptedData, error) {
s, err := b.marshal(data)
if err != nil {
return nil, err
Expand Down Expand Up @@ -1916,7 +1916,7 @@ func (b *Boxer) open(data chat1.EncryptedData, key libkb.NaclSecretBoxKey) ([]by

// signMarshal signs data with a NaclSigningKeyPair, returning a chat1.SignatureInfo.
// It marshals data before signing.
func (b *Boxer) signMarshal(data interface{}, kp libkb.NaclSigningKeyPair, prefix kbcrypto.SignaturePrefix) (chat1.SignatureInfo, error) {
func (b *Boxer) signMarshal(data any, kp libkb.NaclSigningKeyPair, prefix kbcrypto.SignaturePrefix) (chat1.SignatureInfo, error) {
encoded, err := b.marshal(data)
if err != nil {
return chat1.SignatureInfo{}, err
Expand All @@ -1927,7 +1927,7 @@ func (b *Boxer) signMarshal(data interface{}, kp libkb.NaclSigningKeyPair, prefi

// signEncryptMarshal signencrypts data given an encryption and signing key, returning a chat1.SignEncryptedData.
// It marshals data before signing.
func (b *Boxer) signEncryptMarshal(data interface{}, encryptionKey libkb.NaclSecretBoxKey,
func (b *Boxer) signEncryptMarshal(data any, encryptionKey libkb.NaclSecretBoxKey,
signingKeyPair libkb.NaclSigningKeyPair, prefix kbcrypto.SignaturePrefix) (chat1.SignEncryptedData, error) {
encoded, err := b.marshal(data)
if err != nil {
Expand Down Expand Up @@ -2164,7 +2164,7 @@ func (b *Boxer) keybase1KeybaseTimeToTime(t1 keybase1.KeybaseTime) time.Time {
return t2
}

func (b *Boxer) marshal(v interface{}) ([]byte, error) {
func (b *Boxer) marshal(v any) ([]byte, error) {
mh := codec.MsgpackHandle{WriteExt: true}
var data []byte
enc := codec.NewEncoderBytes(&data, &mh)
Expand All @@ -2174,7 +2174,7 @@ func (b *Boxer) marshal(v interface{}) ([]byte, error) {
return data, nil
}

func (b *Boxer) unmarshal(data []byte, v interface{}) error {
func (b *Boxer) unmarshal(data []byte, v any) error {
mh := codec.MsgpackHandle{WriteExt: true}
dec := codec.NewDecoderBytes(data, &mh)
return dec.Decode(&v)
Expand Down
2 changes: 1 addition & 1 deletion go/chat/boxer_canned_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (cm cannedMessage) SenderDeviceID(t *testing.T) gregor1.DeviceID {
return did
}

func (cm cannedMessage) unhex(t *testing.T, out interface{}, inHex string) {
func (cm cannedMessage) unhex(t *testing.T, out any, inHex string) {
bytes, err := hex.DecodeString(inHex)
require.NoError(t, err)
mh := codec.MsgpackHandle{WriteExt: true}
Expand Down
8 changes: 4 additions & 4 deletions go/chat/convdevstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (s *ConvDevConversationBackedStorage) getMembersType(conv chat1.Conversatio
}

func (s *ConvDevConversationBackedStorage) PutToKnownConv(ctx context.Context, uid gregor1.UID,
conv chat1.ConversationLocal, src interface{}) (err error) {
conv chat1.ConversationLocal, src any) (err error) {
if s.adminOnly && !conv.ReaderInfo.UntrustedTeamRole.IsAdminOrAbove() {
return NewDevStoragePermissionDeniedError(conv.ReaderInfo.UntrustedTeamRole)
}
Expand Down Expand Up @@ -91,7 +91,7 @@ func (s *ConvDevConversationBackedStorage) PutToKnownConv(ctx context.Context, u
}

func (s *ConvDevConversationBackedStorage) Put(ctx context.Context, uid gregor1.UID,
convID chat1.ConversationID, name string, src interface{}) (err error) {
convID chat1.ConversationID, name string, src any) (err error) {
defer s.Trace(ctx, &err, "Put(%s)", name)()

var conv chat1.ConversationLocal
Expand All @@ -109,7 +109,7 @@ func (s *ConvDevConversationBackedStorage) Put(ctx context.Context, uid gregor1.
}

func (s *ConvDevConversationBackedStorage) GetFromKnownConv(ctx context.Context, uid gregor1.UID,
conv chat1.ConversationLocal, dest interface{}) (found bool, err error) {
conv chat1.ConversationLocal, dest any) (found bool, err error) {
defer s.Trace(ctx, &err, "GetFromKnownConv(%s)", conv.GetConvID())()
tv, err := s.G().ConvSource.Pull(ctx, conv.GetConvID(), uid, chat1.GetThreadReason_GENERAL, nil,
&chat1.GetThreadQuery{
Expand Down Expand Up @@ -148,7 +148,7 @@ func (s *ConvDevConversationBackedStorage) GetFromKnownConv(ctx context.Context,
}

func (s *ConvDevConversationBackedStorage) Get(ctx context.Context, uid gregor1.UID,
convID chat1.ConversationID, name string, dest interface{}, createConvIfMissing bool) (found bool, conv *chat1.ConversationLocal, err error) {
convID chat1.ConversationID, name string, dest any, createConvIfMissing bool) (found bool, conv *chat1.ConversationLocal, err error) {
defer s.Trace(ctx, &err, "Get(%s)", name)()

baseConv, err := utils.GetVerifiedConv(ctx, s.G(), uid, convID, types.InboxSourceDataSourceAll)
Expand Down
4 changes: 2 additions & 2 deletions go/chat/devstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewDevConversationBackedStorage(g *globals.Context, ri func() chat1.RemoteI
}
}

func (s *DevConversationBackedStorage) Put(ctx context.Context, uid gregor1.UID, name string, src interface{}) (err error) {
func (s *DevConversationBackedStorage) Put(ctx context.Context, uid gregor1.UID, name string, src any) (err error) {
defer s.Trace(ctx, &err, "Put(%s)", name)()
un, err := s.G().GetUPAKLoader().LookupUsername(ctx, keybase1.UID(uid.String()))
if err != nil {
Expand Down Expand Up @@ -63,7 +63,7 @@ func (s *DevConversationBackedStorage) Put(ctx context.Context, uid gregor1.UID,
}

func (s *DevConversationBackedStorage) Get(ctx context.Context, uid gregor1.UID, name string,
dest interface{}) (found bool, err error) {
dest any) (found bool, err error) {
defer s.Trace(ctx, &err, "Get(%s)", name)()
un, err := s.G().GetUPAKLoader().LookupUsername(ctx, keybase1.UID(uid.String()))
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions go/chat/ephemeral_purge_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,14 @@ func (t *EphemeralTracker) OnLogout(mctx libkb.MetaContext) error {
return nil
}

func decode(data []byte, res interface{}) error {
func decode(data []byte, res any) error {
mh := codec.MsgpackHandle{WriteExt: true}
dec := codec.NewDecoderBytes(data, &mh)
err := dec.Decode(res)
return err
}

func encode(input interface{}) ([]byte, error) {
func encode(input any) ([]byte, error) {
mh := codec.MsgpackHandle{WriteExt: true}
var data []byte
enc := codec.NewEncoderBytes(&data, &mh)
Expand Down
4 changes: 2 additions & 2 deletions go/chat/ephemeral_purger.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (pq *priorityQueue) Swap(i, j int) {
// conversation to appear once in the heap. Use
// `BackgroundEphemeralPurger.update` instead since it handles this as
// intended.
func (pq *priorityQueue) Push(x interface{}) {
func (pq *priorityQueue) Push(x any) {
pq.Lock()
defer pq.Unlock()

Expand All @@ -84,7 +84,7 @@ func (pq *priorityQueue) Push(x interface{}) {
pq.itemMap[item.purgeInfo.ConvID.ConvIDStr()] = item
}

func (pq *priorityQueue) Pop() interface{} {
func (pq *priorityQueue) Pop() any {
pq.Lock()
defer pq.Unlock()

Expand Down
12 changes: 6 additions & 6 deletions go/chat/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (e chatThreadConsistencyErrorImpl) Code() ConsistencyErrorCode {
return e.code
}

func NewChatThreadConsistencyError(code ConsistencyErrorCode, msg string, formatArgs ...interface{}) ChatThreadConsistencyError {
func NewChatThreadConsistencyError(code ConsistencyErrorCode, msg string, formatArgs ...any) ChatThreadConsistencyError {
return &chatThreadConsistencyErrorImpl{
code: code,
msg: fmt.Sprintf(msg, formatArgs...),
Expand Down Expand Up @@ -435,17 +435,17 @@ func (e OfflineError) Error() string {
type OfflineClient struct {
}

func (e OfflineClient) Call(ctx context.Context, method string, arg interface{},
res interface{}, timeout time.Duration) error {
func (e OfflineClient) Call(ctx context.Context, method string, arg any,
res any, timeout time.Duration) error {
return OfflineError{}
}

func (e OfflineClient) CallCompressed(ctx context.Context, method string, arg interface{},
res interface{}, ctype rpc.CompressionType, timeout time.Duration) error {
func (e OfflineClient) CallCompressed(ctx context.Context, method string, arg any,
res any, ctype rpc.CompressionType, timeout time.Duration) error {
return OfflineError{}
}

func (e OfflineClient) Notify(ctx context.Context, method string, arg interface{}, timeout time.Duration) error {
func (e OfflineClient) Notify(ctx context.Context, method string, arg any, timeout time.Duration) error {
return OfflineError{}
}

Expand Down
4 changes: 2 additions & 2 deletions go/chat/flip/chat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ func (c *chatClient) ServerTime(context.Context) (time.Time, error) {
return c.Clock().Now(), nil
}

func testPrintf(fmtString string, args ...interface{}) {
func testPrintf(fmtString string, args ...any) {
if testing.Verbose() {
fmt.Printf(fmtString, args...)
}
}

func (c *chatClient) CLogf(ctx context.Context, fmtString string, args ...interface{}) {
func (c *chatClient) CLogf(ctx context.Context, fmtString string, args ...any) {
testPrintf(fmtString+"\n", args...)
}

Expand Down
2 changes: 1 addition & 1 deletion go/chat/flip/dealer.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ type Game struct {
me *playerControl
commitmentCompleteHash Hash
clock func() clockwork.Clock
clogf func(ctx context.Context, fmt string, args ...interface{})
clogf func(ctx context.Context, fmt string, args ...any)

// To handle reorderings between CommitmentComplete and commitements,
// wee need some extra bookkeeping.
Expand Down
2 changes: 1 addition & 1 deletion go/chat/flip/dealer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (t *testDealersHelper) ServerTime(context.Context) (time.Time, error) {
return t.clock.Now(), nil
}

func (t *testDealersHelper) CLogf(ctx context.Context, fmtString string, args ...interface{}) {
func (t *testDealersHelper) CLogf(ctx context.Context, fmtString string, args ...any) {
testPrintf(fmtString+"\n", args...)
}

Expand Down
2 changes: 1 addition & 1 deletion go/chat/flip/flip.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type Dealer struct {

// ReplayHelper contains hooks needed to replay a flip.
type ReplayHelper interface {
CLogf(ctx context.Context, fmt string, args ...interface{})
CLogf(ctx context.Context, fmt string, args ...any)
}

// DealersHelper is an interface that calling chat clients need to implement.
Expand Down
Loading