this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

lint: use default 'go vet' settings (#512)

Pretty straight-forward, we do this in other repos. Run *all* `go vet`
rules, not just a fixed list (the default is all rules).

authored by

bnewbold and committed by
GitHub
0051bd3e 81f8957f

+40 -40
+1 -1
Makefile
··· 51 51 52 52 .PHONY: lint 53 53 lint: ## Verify code style and run static checks 54 - go vet -asmdecl -assign -atomic -bools -buildtag -cgocall -copylocks -httpresponse -loopclosure -lostcancel -nilfunc -printf -shift -stdmethods -structtag -tests -unmarshal -unreachable -unsafeptr -unusedresult ./... 54 + go vet ./... 55 55 test -z $(gofmt -l ./...) 56 56 57 57 .PHONY: fmt
+8 -8
carstore/bs.go
··· 158 158 Model(blockRef{}). 159 159 Select("path, block_refs.offset"). 160 160 Joins("left join car_shards on block_refs.shard = car_shards.id"). 161 - Where("usr = ? AND cid = ?", uv.user, models.DbCID{k}). 161 + Where("usr = ? AND cid = ?", uv.user, models.DbCID{CID: k}). 162 162 Count(&count).Error; err != nil { 163 163 return false, err 164 164 } ··· 194 194 Model(blockRef{}). 195 195 Select("path, block_refs.offset"). 196 196 Joins("left join car_shards on block_refs.shard = car_shards.id"). 197 - Where("usr = ? AND cid = ?", uv.user, models.DbCID{k}). 197 + Where("usr = ? AND cid = ?", uv.user, models.DbCID{CID: k}). 198 198 Find(&info).Error; err != nil { 199 199 return nil, err 200 200 } 201 201 if info.Path == "" { 202 - return nil, ipld.ErrNotFound{k} 202 + return nil, ipld.ErrNotFound{Cid: k} 203 203 } 204 204 205 205 if uv.prefetch { ··· 581 581 } 582 582 583 583 if _, ok := ds.blks[c]; !ok { 584 - return ipld.ErrNotFound{c} 584 + return ipld.ErrNotFound{Cid: c} 585 585 } 586 586 587 587 delete(ds.blks, c) ··· 712 712 // adding things to the db by map is the only way to get gorm to not 713 713 // add the 'returning' clause, which costs a lot of time 714 714 brefs = append(brefs, map[string]interface{}{ 715 - "cid": models.DbCID{k}, 715 + "cid": models.DbCID{CID: k}, 716 716 "offset": offset, 717 717 }) 718 718 ··· 725 725 } 726 726 727 727 shard := CarShard{ 728 - Root: models.DbCID{root}, 728 + Root: models.DbCID{CID: root}, 729 729 DataStart: hnw, 730 730 Seq: seq, 731 731 Path: path, ··· 1582 1582 } 1583 1583 1584 1584 nbrefs = append(nbrefs, map[string]interface{}{ 1585 - "cid": models.DbCID{blk.Cid()}, 1585 + "cid": models.DbCID{CID: blk.Cid()}, 1586 1586 "offset": offset, 1587 1587 }) 1588 1588 ··· 1596 1596 } 1597 1597 1598 1598 shard := CarShard{ 1599 - Root: models.DbCID{root}, 1599 + Root: models.DbCID{CID: root}, 1600 1600 DataStart: hnw, 1601 1601 Seq: lastsh.Seq, 1602 1602 Path: path,
+1 -1
cmd/bigsky/main.go
··· 313 313 314 314 var blobstore blobs.BlobStore 315 315 if bsdir := cctx.String("disk-blob-store"); bsdir != "" { 316 - blobstore = &blobs.DiskBlobStore{bsdir} 316 + blobstore = &blobs.DiskBlobStore{Dir: bsdir} 317 317 } 318 318 319 319 prodHR, err := api.NewProdHandleResolver(100_000)
+2 -2
cmd/gosky/bsky.go
··· 53 53 resp, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{ 54 54 Collection: "app.bsky.graph.follow", 55 55 Repo: xrpcc.Auth.Did, 56 - Record: &lexutil.LexiconTypeDecoder{&follow}, 56 + Record: &lexutil.LexiconTypeDecoder{Val: &follow}, 57 57 }) 58 58 if err != nil { 59 59 return err ··· 111 111 resp, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{ 112 112 Collection: "app.bsky.feed.post", 113 113 Repo: auth.Did, 114 - Record: &lexutil.LexiconTypeDecoder{&appbsky.FeedPost{ 114 + Record: &lexutil.LexiconTypeDecoder{Val: &appbsky.FeedPost{ 115 115 Text: text, 116 116 CreatedAt: time.Now().Format(util.ISO8601), 117 117 }},
+2 -2
cmd/gosky/main.go
··· 120 120 enc := rejson.NewEncoder(buf, rejson.EncodeOptions{}) 121 121 122 122 dec := cbor.NewDecoder(cbor.DecodeOptions{}, bytes.NewReader(data)) 123 - err := shared.TokenPump{dec, enc}.Run() 123 + err := shared.TokenPump{TokenSource: dec, TokenSink: enc}.Run() 124 124 if err != nil { 125 125 return nil, err 126 126 } ··· 544 544 545 545 ctx := context.TODO() 546 546 547 - rec := &lexutil.LexiconTypeDecoder{&bsky.FeedGenerator{ 547 + rec := &lexutil.LexiconTypeDecoder{Val: &bsky.FeedGenerator{ 548 548 CreatedAt: time.Now().Format(util.ISO8601), 549 549 Description: desc, 550 550 Did: did,
+1 -1
cmd/stress/main.go
··· 135 135 res, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{ 136 136 Collection: "app.bsky.feed.post", 137 137 Repo: xrpcc.Auth.Did, 138 - Record: &lexutil.LexiconTypeDecoder{&appbsky.FeedPost{ 138 + Record: &lexutil.LexiconTypeDecoder{Val: &appbsky.FeedPost{ 139 139 Text: hex.EncodeToString(buf), 140 140 CreatedAt: time.Now().Format(time.RFC3339), 141 141 }},
+2 -2
events/dbpersist.go
··· 278 278 279 279 var prev *models.DbCID 280 280 if evt.Prev != nil && evt.Prev.Defined() { 281 - prev = &models.DbCID{cid.Cid(*evt.Prev)} 281 + prev = &models.DbCID{CID: cid.Cid(*evt.Prev)} 282 282 } 283 283 284 284 var blobs []byte ··· 296 296 } 297 297 298 298 rer := RepoEventRecord{ 299 - Commit: &models.DbCID{cid.Cid(evt.Commit)}, 299 + Commit: &models.DbCID{CID: cid.Cid(evt.Commit)}, 300 300 Prev: prev, 301 301 Repo: uid, 302 302 Type: "repo_append", // TODO: refactor to "#commit"? can "rebase" come through this path?
+6 -6
fakedata/generators.go
··· 115 115 Repo: acc.Auth.Did, 116 116 Collection: "app.bsky.actor.profile", 117 117 Rkey: "self", 118 - Record: &lexutil.LexiconTypeDecoder{&appbsky.ActorProfile{ 118 + Record: &lexutil.LexiconTypeDecoder{Val: &appbsky.ActorProfile{ 119 119 Description: &desc, 120 120 DisplayName: &name, 121 121 Avatar: avatar, ··· 201 201 if _, err := comatproto.RepoCreateRecord(ctx, xrpcc, &comatproto.RepoCreateRecord_Input{ 202 202 Collection: "app.bsky.feed.post", 203 203 Repo: acc.Auth.Did, 204 - Record: &lexutil.LexiconTypeDecoder{&post}, 204 + Record: &lexutil.LexiconTypeDecoder{Val: &post}, 205 205 }); err != nil { 206 206 return err 207 207 } ··· 218 218 _, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{ 219 219 Collection: "app.bsky.graph.follow", 220 220 Repo: xrpcc.Auth.Did, 221 - Record: &lexutil.LexiconTypeDecoder{follow}, 221 + Record: &lexutil.LexiconTypeDecoder{Val: follow}, 222 222 }) 223 223 return err 224 224 } ··· 236 236 _, err := comatproto.RepoCreateRecord(ctx, xrpcc, &comatproto.RepoCreateRecord_Input{ 237 237 Collection: "app.bsky.feed.like", 238 238 Repo: xrpcc.Auth.Did, 239 - Record: &lexutil.LexiconTypeDecoder{&like}, 239 + Record: &lexutil.LexiconTypeDecoder{Val: &like}, 240 240 }) 241 241 return err 242 242 } ··· 252 252 _, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{ 253 253 Collection: "app.bsky.feed.repost", 254 254 Repo: xrpcc.Auth.Did, 255 - Record: &lexutil.LexiconTypeDecoder{repost}, 255 + Record: &lexutil.LexiconTypeDecoder{Val: repost}, 256 256 }) 257 257 return err 258 258 } ··· 284 284 _, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{ 285 285 Collection: "app.bsky.feed.post", 286 286 Repo: xrpcc.Auth.Did, 287 - Record: &lexutil.LexiconTypeDecoder{replyPost}, 287 + Record: &lexutil.LexiconTypeDecoder{Val: replyPost}, 288 288 }) 289 289 return err 290 290 }
+1 -1
labeler/admin.go
··· 34 34 Moderation: nil, 35 35 Repo: repoView, 36 36 // TODO: replace with actual record (from proxied backend) 37 - Value: &lexutil.LexiconTypeDecoder{&appbsky.FeedPost{}}, 37 + Value: &lexutil.LexiconTypeDecoder{Val: &appbsky.FeedPost{}}, 38 38 } 39 39 if uri != nil { 40 40 recordView.Uri = *uri
+2 -2
lex/util/lex_interop_old_test.go
··· 91 91 assert.NoError(goObj.MarshalCBOR(goCborBytes)) 92 92 assert.Equal(cborBytes, goCborBytes.Bytes()) 93 93 // 0x71 = dag-cbor, 0x12 = sha2-256, 0 = default length 94 - cidBuilder := cid.V1Builder{0x71, 0x12, 0} 94 + cidBuilder := cid.V1Builder{Codec: 0x71, MhType: 0x12, MhLength: 0} 95 95 goCborCid, err := cidBuilder.Sum(goCborBytes.Bytes()) 96 96 assert.NoError(err) 97 97 assert.Equal(cidStr, goCborCid.String()) ··· 156 156 assert.NoError(goObj.MarshalCBOR(goCborBytes)) 157 157 assert.Equal(cborBytes, goCborBytes.Bytes()) 158 158 // 0x71 = dag-cbor, 0x12 = sha2-256, 0 = default length 159 - cidBuilder := cid.V1Builder{0x71, 0x12, 0} 159 + cidBuilder := cid.V1Builder{Codec: 0x71, MhType: 0x12, MhLength: 0} 160 160 goCborCid, err := cidBuilder.Sum(goCborBytes.Bytes()) 161 161 assert.NoError(err) 162 162 assert.Equal(cidStr, goCborCid.String())
+3 -3
lex/util/lex_interop_test.go
··· 122 122 assert.NoError(goObj.MarshalCBOR(goCborBytes)) 123 123 assert.Equal(cborBytes, goCborBytes.Bytes()) 124 124 // 0x71 = dag-cbor, 0x12 = sha2-256, 0 = default length 125 - cidBuilder := cid.V1Builder{0x71, 0x12, 0} 125 + cidBuilder := cid.V1Builder{Codec: 0x71, MhType: 0x12, MhLength: 0} 126 126 goCborCid, err := cidBuilder.Sum(goCborBytes.Bytes()) 127 127 assert.NoError(err) 128 128 assert.Equal(cidStr, goCborCid.String()) ··· 208 208 assert.NoError(goObj.MarshalCBOR(goCborBytes)) 209 209 assert.Equal(cborBytes, goCborBytes.Bytes()) 210 210 // 0x71 = dag-cbor, 0x12 = sha2-256, 0 = default length 211 - cidBuilder := cid.V1Builder{0x71, 0x12, 0} 211 + cidBuilder := cid.V1Builder{Codec: 0x71, MhType: 0x12, MhLength: 0} 212 212 goCborCid, err := cidBuilder.Sum(goCborBytes.Bytes()) 213 213 assert.NoError(err) 214 214 assert.Equal(cidStr, goCborCid.String()) ··· 314 314 assert.NoError(goObj.MarshalCBOR(goCborBytes)) 315 315 assert.Equal(cborBytes, goCborBytes.Bytes()) 316 316 // 0x71 = dag-cbor, 0x12 = sha2-256, 0 = default length 317 - cidBuilder := cid.V1Builder{ 0x71, 0x12, 0 } 317 + cidBuilder := cid.V1Builder{Codec: 0x71, MhType: 0x12, MhLength: 0} 318 318 goCborCid, err := cidBuilder.Sum(goCborBytes.Bytes()) 319 319 assert.NoError(err) 320 320 assert.Equal(cidStr, goCborCid.String())
+3 -3
notifs/notifs.go
··· 214 214 rsub := "at://" + postAuthor.Did + "/app.bsky.feed.post/" + reposted.Rkey 215 215 216 216 return &appbskytypes.NotificationListNotifications_Notification{ 217 - Record: &lexutil.LexiconTypeDecoder{rec}, 217 + Record: &lexutil.LexiconTypeDecoder{Val: rec}, 218 218 IsRead: nrec.CreatedAt.Before(lastSeen), 219 219 IndexedAt: nrec.CreatedAt.Format(time.RFC3339), 220 220 Uri: "at://" + reposter.Did + "/app.bsky.feed.repost/" + repost.Rkey, ··· 254 254 rsub := "at://" + opAuthor.Did + "/app.bsky.feed.post/" + replyTo.Rkey 255 255 256 256 return &appbskytypes.NotificationListNotifications_Notification{ 257 - Record: &lexutil.LexiconTypeDecoder{rec}, 257 + Record: &lexutil.LexiconTypeDecoder{Val: rec}, 258 258 IsRead: nrec.CreatedAt.Before(lastSeen), 259 259 IndexedAt: nrec.CreatedAt.Format(time.RFC3339), 260 260 Uri: "at://" + author.Did + "/app.bsky.feed.post/" + fp.Rkey, ··· 282 282 } 283 283 284 284 return &appbskytypes.NotificationListNotifications_Notification{ 285 - Record: &lexutil.LexiconTypeDecoder{rec}, 285 + Record: &lexutil.LexiconTypeDecoder{Val: rec}, 286 286 IsRead: nrec.CreatedAt.Before(lastSeen), 287 287 IndexedAt: nrec.CreatedAt.Format(time.RFC3339), 288 288 Uri: "at://" + follower.Did + "/app.bsky.graph.follow/" + frec.Rkey,
+1 -1
pds/feedgen.go
··· 148 148 return nil, err 149 149 } 150 150 151 - out.Post.Record = &lexutil.LexiconTypeDecoder{rec} 151 + out.Post.Record = &lexutil.LexiconTypeDecoder{Val: rec} 152 152 153 153 return out, nil 154 154 }
+1 -1
pds/handlers.go
··· 206 206 return &comatprototypes.RepoGetRecord_Output{ 207 207 Cid: &ccstr, 208 208 Uri: "at://" + targetUser.Did + "/" + collection + "/" + rkey, 209 - Value: &lexutil.LexiconTypeDecoder{rec}, 209 + Value: &lexutil.LexiconTypeDecoder{Val: rec}, 210 210 }, nil 211 211 } 212 212
+1 -1
testing/car_did_repro_test.go
··· 106 106 func reproduceRecord(t *testing.T, path string, c cid.Cid, rec cbg.CBORMarshaler) { 107 107 assert := assert.New(t) 108 108 // 0x71 = dag-cbor, 0x12 = sha2-256, 0 = default length 109 - cidBuilder := cid.V1Builder{0x71, 0x12, 0} 109 + cidBuilder := cid.V1Builder{Codec: 0x71, MhType: 0x12, MhLength: 0} 110 110 recordCBOR := new(bytes.Buffer) 111 111 nsid := strings.SplitN(path, "/", 2)[0] 112 112
+1 -1
testing/feedpost_test.go
··· 150 150 // checks a corner-case with $type: "app.bsky.richtext.facet#link" 151 151 func TestFeedPostRichtextLink(t *testing.T) { 152 152 assert := assert.New(t) 153 - cidBuilder := cid.V1Builder{0x71, 0x12, 0} 153 + cidBuilder := cid.V1Builder{Codec: 0x71, MhType: 0x12, MhLength: 0} 154 154 155 155 // this is a app.bsky.feed.post with richtext link 156 156 inFile, err := os.Open("testdata/post_richtext_link.cbor")
+4 -4
testing/utils.go
··· 231 231 resp, err := atproto.RepoCreateRecord(ctx, u.client, &atproto.RepoCreateRecord_Input{ 232 232 Collection: "app.bsky.feed.post", 233 233 Repo: u.did, 234 - Record: &lexutil.LexiconTypeDecoder{&bsky.FeedPost{ 234 + Record: &lexutil.LexiconTypeDecoder{Val: &bsky.FeedPost{ 235 235 CreatedAt: time.Now().Format(time.RFC3339), 236 236 Text: body, 237 237 Reply: &bsky.FeedPost_ReplyRef{ ··· 258 258 resp, err := atproto.RepoCreateRecord(ctx, u.client, &atproto.RepoCreateRecord_Input{ 259 259 Collection: "app.bsky.feed.post", 260 260 Repo: u.did, 261 - Record: &lexutil.LexiconTypeDecoder{&bsky.FeedPost{ 261 + Record: &lexutil.LexiconTypeDecoder{Val: &bsky.FeedPost{ 262 262 CreatedAt: time.Now().Format(time.RFC3339), 263 263 Text: body, 264 264 }}, ··· 281 281 _, err := atproto.RepoCreateRecord(ctx, u.client, &atproto.RepoCreateRecord_Input{ 282 282 Collection: "app.bsky.feed.vote", 283 283 Repo: u.did, 284 - Record: &lexutil.LexiconTypeDecoder{&bsky.FeedLike{ 284 + Record: &lexutil.LexiconTypeDecoder{Val: &bsky.FeedLike{ 285 285 LexiconTypeID: "app.bsky.feed.vote", 286 286 CreatedAt: time.Now().Format(time.RFC3339), 287 287 Subject: post, ··· 300 300 resp, err := atproto.RepoCreateRecord(ctx, u.client, &atproto.RepoCreateRecord_Input{ 301 301 Collection: "app.bsky.graph.follow", 302 302 Repo: u.did, 303 - Record: &lexutil.LexiconTypeDecoder{&bsky.GraphFollow{ 303 + Record: &lexutil.LexiconTypeDecoder{Val: &bsky.GraphFollow{ 304 304 CreatedAt: time.Now().Format(time.RFC3339), 305 305 Subject: did, 306 306 }},