Skip to content

Commit

Permalink
vet: LexiconTypeDecoder struct fields
Browse files Browse the repository at this point in the history
  • Loading branch information
bnewbold committed Dec 30, 2023
1 parent 611fed0 commit 7cfee24
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions cmd/gosky/bsky.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var bskyFollowCmd = &cli.Command{
resp, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{
Collection: "app.bsky.graph.follow",
Repo: xrpcc.Auth.Did,
Record: &lexutil.LexiconTypeDecoder{&follow},
Record: &lexutil.LexiconTypeDecoder{Val: &follow},
})
if err != nil {
return err
Expand Down Expand Up @@ -111,7 +111,7 @@ var bskyPostCmd = &cli.Command{
resp, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{
Collection: "app.bsky.feed.post",
Repo: auth.Did,
Record: &lexutil.LexiconTypeDecoder{&appbsky.FeedPost{
Record: &lexutil.LexiconTypeDecoder{Val: &appbsky.FeedPost{
Text: text,
CreatedAt: time.Now().Format(util.ISO8601),
}},
Expand Down
2 changes: 1 addition & 1 deletion cmd/gosky/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ var createFeedGeneratorCmd = &cli.Command{

ctx := context.TODO()

rec := &lexutil.LexiconTypeDecoder{&bsky.FeedGenerator{
rec := &lexutil.LexiconTypeDecoder{Val: &bsky.FeedGenerator{
CreatedAt: time.Now().Format(util.ISO8601),
Description: desc,
Did: did,
Expand Down
2 changes: 1 addition & 1 deletion cmd/stress/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ var postingCmd = &cli.Command{
res, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{
Collection: "app.bsky.feed.post",
Repo: xrpcc.Auth.Did,
Record: &lexutil.LexiconTypeDecoder{&appbsky.FeedPost{
Record: &lexutil.LexiconTypeDecoder{Val: &appbsky.FeedPost{
Text: hex.EncodeToString(buf),
CreatedAt: time.Now().Format(time.RFC3339),
}},
Expand Down
12 changes: 6 additions & 6 deletions fakedata/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func GenProfile(xrpcc *xrpc.Client, acc *AccountContext, genAvatar, genBanner bo
Repo: acc.Auth.Did,
Collection: "app.bsky.actor.profile",
Rkey: "self",
Record: &lexutil.LexiconTypeDecoder{&appbsky.ActorProfile{
Record: &lexutil.LexiconTypeDecoder{Val: &appbsky.ActorProfile{
Description: &desc,
DisplayName: &name,
Avatar: avatar,
Expand Down Expand Up @@ -201,7 +201,7 @@ func GenPosts(xrpcc *xrpc.Client, catalog *AccountCatalog, acc *AccountContext,
if _, err := comatproto.RepoCreateRecord(ctx, xrpcc, &comatproto.RepoCreateRecord_Input{
Collection: "app.bsky.feed.post",
Repo: acc.Auth.Did,
Record: &lexutil.LexiconTypeDecoder{&post},
Record: &lexutil.LexiconTypeDecoder{Val: &post},
}); err != nil {
return err
}
Expand All @@ -218,7 +218,7 @@ func CreateFollow(xrpcc *xrpc.Client, tgt *AccountContext) error {
_, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{
Collection: "app.bsky.graph.follow",
Repo: xrpcc.Auth.Did,
Record: &lexutil.LexiconTypeDecoder{follow},
Record: &lexutil.LexiconTypeDecoder{Val: follow},
})
return err
}
Expand All @@ -236,7 +236,7 @@ func CreateLike(xrpcc *xrpc.Client, viewPost *appbsky.FeedDefs_FeedViewPost) err
_, err := comatproto.RepoCreateRecord(ctx, xrpcc, &comatproto.RepoCreateRecord_Input{
Collection: "app.bsky.feed.like",
Repo: xrpcc.Auth.Did,
Record: &lexutil.LexiconTypeDecoder{&like},
Record: &lexutil.LexiconTypeDecoder{Val: &like},
})
return err
}
Expand All @@ -252,7 +252,7 @@ func CreateRepost(xrpcc *xrpc.Client, viewPost *appbsky.FeedDefs_FeedViewPost) e
_, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{
Collection: "app.bsky.feed.repost",
Repo: xrpcc.Auth.Did,
Record: &lexutil.LexiconTypeDecoder{repost},
Record: &lexutil.LexiconTypeDecoder{Val: repost},
})
return err
}
Expand Down Expand Up @@ -284,7 +284,7 @@ func CreateReply(xrpcc *xrpc.Client, viewPost *appbsky.FeedDefs_FeedViewPost) er
_, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{
Collection: "app.bsky.feed.post",
Repo: xrpcc.Auth.Did,
Record: &lexutil.LexiconTypeDecoder{replyPost},
Record: &lexutil.LexiconTypeDecoder{Val: replyPost},
})
return err
}
Expand Down
2 changes: 1 addition & 1 deletion labeler/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (s *Server) hydrateRecordView(ctx context.Context, did string, uri, cid *st
Moderation: nil,
Repo: repoView,
// TODO: replace with actual record (from proxied backend)
Value: &lexutil.LexiconTypeDecoder{&appbsky.FeedPost{}},
Value: &lexutil.LexiconTypeDecoder{Val: &appbsky.FeedPost{}},
}
if uri != nil {
recordView.Uri = *uri
Expand Down
6 changes: 3 additions & 3 deletions notifs/notifs.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (nm *DBNotifMan) hydrateNotificationRepost(ctx context.Context, nrec *Notif
rsub := "at://" + postAuthor.Did + "/app.bsky.feed.post/" + reposted.Rkey

return &appbskytypes.NotificationListNotifications_Notification{
Record: &lexutil.LexiconTypeDecoder{rec},
Record: &lexutil.LexiconTypeDecoder{Val: rec},
IsRead: nrec.CreatedAt.Before(lastSeen),
IndexedAt: nrec.CreatedAt.Format(time.RFC3339),
Uri: "at://" + reposter.Did + "/app.bsky.feed.repost/" + repost.Rkey,
Expand Down Expand Up @@ -254,7 +254,7 @@ func (nm *DBNotifMan) hydrateNotificationReply(ctx context.Context, nrec *NotifR
rsub := "at://" + opAuthor.Did + "/app.bsky.feed.post/" + replyTo.Rkey

return &appbskytypes.NotificationListNotifications_Notification{
Record: &lexutil.LexiconTypeDecoder{rec},
Record: &lexutil.LexiconTypeDecoder{Val: rec},
IsRead: nrec.CreatedAt.Before(lastSeen),
IndexedAt: nrec.CreatedAt.Format(time.RFC3339),
Uri: "at://" + author.Did + "/app.bsky.feed.post/" + fp.Rkey,
Expand Down Expand Up @@ -282,7 +282,7 @@ func (nm *DBNotifMan) hydrateNotificationFollow(ctx context.Context, nrec *Notif
}

return &appbskytypes.NotificationListNotifications_Notification{
Record: &lexutil.LexiconTypeDecoder{rec},
Record: &lexutil.LexiconTypeDecoder{Val: rec},
IsRead: nrec.CreatedAt.Before(lastSeen),
IndexedAt: nrec.CreatedAt.Format(time.RFC3339),
Uri: "at://" + follower.Did + "/app.bsky.graph.follow/" + frec.Rkey,
Expand Down
2 changes: 1 addition & 1 deletion pds/feedgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (fg *FeedGenerator) hydrateItem(ctx context.Context, item *models.FeedPost)
return nil, err
}

out.Post.Record = &lexutil.LexiconTypeDecoder{rec}
out.Post.Record = &lexutil.LexiconTypeDecoder{Val: rec}

return out, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pds/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ func (s *Server) handleComAtprotoRepoGetRecord(ctx context.Context, c string, co
return &comatprototypes.RepoGetRecord_Output{
Cid: &ccstr,
Uri: "at://" + targetUser.Did + "/" + collection + "/" + rkey,
Value: &lexutil.LexiconTypeDecoder{rec},
Value: &lexutil.LexiconTypeDecoder{Val: rec},
}, nil
}

Expand Down
8 changes: 4 additions & 4 deletions testing/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (u *TestUser) Reply(t *testing.T, replyto, root *atproto.RepoStrongRef, bod
resp, err := atproto.RepoCreateRecord(ctx, u.client, &atproto.RepoCreateRecord_Input{
Collection: "app.bsky.feed.post",
Repo: u.did,
Record: &lexutil.LexiconTypeDecoder{&bsky.FeedPost{
Record: &lexutil.LexiconTypeDecoder{Val: &bsky.FeedPost{
CreatedAt: time.Now().Format(time.RFC3339),
Text: body,
Reply: &bsky.FeedPost_ReplyRef{
Expand All @@ -258,7 +258,7 @@ func (u *TestUser) Post(t *testing.T, body string) *atproto.RepoStrongRef {
resp, err := atproto.RepoCreateRecord(ctx, u.client, &atproto.RepoCreateRecord_Input{
Collection: "app.bsky.feed.post",
Repo: u.did,
Record: &lexutil.LexiconTypeDecoder{&bsky.FeedPost{
Record: &lexutil.LexiconTypeDecoder{Val: &bsky.FeedPost{
CreatedAt: time.Now().Format(time.RFC3339),
Text: body,
}},
Expand All @@ -281,7 +281,7 @@ func (u *TestUser) Like(t *testing.T, post *atproto.RepoStrongRef) {
_, err := atproto.RepoCreateRecord(ctx, u.client, &atproto.RepoCreateRecord_Input{
Collection: "app.bsky.feed.vote",
Repo: u.did,
Record: &lexutil.LexiconTypeDecoder{&bsky.FeedLike{
Record: &lexutil.LexiconTypeDecoder{Val: &bsky.FeedLike{
LexiconTypeID: "app.bsky.feed.vote",
CreatedAt: time.Now().Format(time.RFC3339),
Subject: post,
Expand All @@ -300,7 +300,7 @@ func (u *TestUser) Follow(t *testing.T, did string) string {
resp, err := atproto.RepoCreateRecord(ctx, u.client, &atproto.RepoCreateRecord_Input{
Collection: "app.bsky.graph.follow",
Repo: u.did,
Record: &lexutil.LexiconTypeDecoder{&bsky.GraphFollow{
Record: &lexutil.LexiconTypeDecoder{Val: &bsky.GraphFollow{
CreatedAt: time.Now().Format(time.RFC3339),
Subject: did,
}},
Expand Down

0 comments on commit 7cfee24

Please sign in to comment.