Skip to content

Commit

Permalink
apply all gopls fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Nov 18, 2024
1 parent df00d35 commit 0923612
Show file tree
Hide file tree
Showing 14 changed files with 176 additions and 178 deletions.
6 changes: 3 additions & 3 deletions ap/array_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func TestArrayMarshal_OneTag(t *testing.T) {
}{
ID: "a",
Tag: []Tag{
Tag{
{
Type: Hashtag,
Name: "b",
},
Expand All @@ -140,11 +140,11 @@ func TestArrayMarshal_TwoTags(t *testing.T) {
}{
ID: "a",
Tag: []Tag{
Tag{
{
Type: Hashtag,
Name: "b",
},
Tag{
{
Type: Emoji,
Name: "c",
},
Expand Down
12 changes: 6 additions & 6 deletions fed/blocklist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestBlockList_NotBlockedDomain(t *testing.T) {

blockList := BlockList{}
blockList.domains = map[string]struct{}{
"0.0.0.0.com": struct{}{},
"0.0.0.0.com": {},
}

assert.False(blockList.Contains("127.0.0.1.com"))
Expand All @@ -37,7 +37,7 @@ func TestBlockList_BlockedDomain(t *testing.T) {

blockList := BlockList{}
blockList.domains = map[string]struct{}{
"0.0.0.0.com": struct{}{},
"0.0.0.0.com": {},
}

assert.True(blockList.Contains("0.0.0.0.com"))
Expand All @@ -48,7 +48,7 @@ func TestBlockList_BlockedSubdomain(t *testing.T) {

blockList := BlockList{}
blockList.domains = map[string]struct{}{
"social.0.0.0.0.com": struct{}{},
"social.0.0.0.0.com": {},
}

assert.True(blockList.Contains("social.0.0.0.0.com"))
Expand All @@ -59,7 +59,7 @@ func TestBlockList_NotBlockedSubdomain(t *testing.T) {

blockList := BlockList{}
blockList.domains = map[string]struct{}{
"social.0.0.0.0.com": struct{}{},
"social.0.0.0.0.com": {},
}

assert.False(blockList.Contains("blog.0.0.0.0.com"))
Expand All @@ -70,7 +70,7 @@ func TestBlockList_BlockedSubdomainByDomain(t *testing.T) {

blockList := BlockList{}
blockList.domains = map[string]struct{}{
"0.0.0.0.com": struct{}{},
"0.0.0.0.com": {},
}

assert.True(blockList.Contains("social.0.0.0.0.com"))
Expand All @@ -81,7 +81,7 @@ func TestBlockList_BlockedSubdomainByDomainEndsWithDot(t *testing.T) {

blockList := BlockList{}
blockList.domains = map[string]struct{}{
"0.0.0.0.com": struct{}{},
"0.0.0.0.com": {},
}

assert.True(blockList.Contains("social.0.0.0.0.com."))
Expand Down
70 changes: 35 additions & 35 deletions fed/deliver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ func TestDeliver_TwoUsersTwoPosts(t *testing.T) {
cfg.MinActorAge = 0

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/dan": testResponse{
"https://ip6-allnodes/inbox/dan": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
},
},
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -127,7 +127,7 @@ func TestDeliver_TwoUsersTwoPosts(t *testing.T) {
assert.NoError(err)

client.Data = map[string]testResponse{
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -159,13 +159,13 @@ func TestDeliver_ForwardedPost(t *testing.T) {
cfg.MinActorAge = 0

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/dan": testResponse{
"https://ip6-allnodes/inbox/dan": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
},
},
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -256,13 +256,13 @@ func TestDeliver_OneFailed(t *testing.T) {
cfg.MinActorAge = 0

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/dan": testResponse{
"https://ip6-allnodes/inbox/dan": {
Response: &http.Response{
StatusCode: http.StatusInternalServerError,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
},
},
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -332,7 +332,7 @@ func TestDeliver_OneFailed(t *testing.T) {
assert.NoError(err)

client.Data = map[string]testResponse{
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -364,13 +364,13 @@ func TestDeliver_OneFailedRetry(t *testing.T) {
cfg.MinActorAge = 0

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/dan": testResponse{
"https://ip6-allnodes/inbox/dan": {
Response: &http.Response{
StatusCode: http.StatusInternalServerError,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
},
},
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -427,7 +427,7 @@ func TestDeliver_OneFailedRetry(t *testing.T) {
cfg.DeliveryRetryInterval = 0

client.Data = map[string]testResponse{
"https://ip6-allnodes/inbox/dan": testResponse{
"https://ip6-allnodes/inbox/dan": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -461,7 +461,7 @@ func TestDeliver_OneInvalidURLRetry(t *testing.T) {
cfg.MinActorAge = 0

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -545,13 +545,13 @@ func TestDeliver_MaxAttempts(t *testing.T) {
cfg.MinActorAge = 0

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/dan": testResponse{
"https://ip6-allnodes/inbox/dan": {
Response: &http.Response{
StatusCode: http.StatusInternalServerError,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
},
},
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -609,7 +609,7 @@ func TestDeliver_MaxAttempts(t *testing.T) {
cfg.MaxDeliveryAttempts = 2

client.Data = map[string]testResponse{
"https://ip6-allnodes/inbox/dan": testResponse{
"https://ip6-allnodes/inbox/dan": {
Response: &http.Response{
StatusCode: http.StatusInternalServerError,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -643,13 +643,13 @@ func TestDeliver_SharedInbox(t *testing.T) {
cfg.MinActorAge = 0

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/nobody": testResponse{
"https://ip6-allnodes/inbox/nobody": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
},
},
"https://ip6-allnodes/inbox/frank": testResponse{
"https://ip6-allnodes/inbox/frank": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -734,13 +734,13 @@ func TestDeliver_SharedInboxRetry(t *testing.T) {
cfg.MinActorAge = 0

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/nobody": testResponse{
"https://ip6-allnodes/inbox/nobody": {
Response: &http.Response{
StatusCode: http.StatusInternalServerError,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
},
},
"https://ip6-allnodes/inbox/frank": testResponse{
"https://ip6-allnodes/inbox/frank": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -807,7 +807,7 @@ func TestDeliver_SharedInboxRetry(t *testing.T) {
cfg.DeliveryRetryInterval = 0

client.Data = map[string]testResponse{
"https://ip6-allnodes/inbox/nobody": testResponse{
"https://ip6-allnodes/inbox/nobody": {
Response: &http.Response{
StatusCode: http.StatusInternalServerError,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -839,13 +839,13 @@ func TestDeliver_SharedInboxUnknownActor(t *testing.T) {
cfg.MinActorAge = 0

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/nobody": testResponse{
"https://ip6-allnodes/inbox/nobody": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
},
},
"https://ip6-allnodes/inbox/frank": testResponse{
"https://ip6-allnodes/inbox/frank": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -931,13 +931,13 @@ func TestDeliver_SharedInboxSingleWorker(t *testing.T) {
cfg.DeliveryWorkers = 1

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/nobody": testResponse{
"https://ip6-allnodes/inbox/nobody": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
},
},
"https://ip6-allnodes/inbox/frank": testResponse{
"https://ip6-allnodes/inbox/frank": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -1022,13 +1022,13 @@ func TestDeliver_SameInbox(t *testing.T) {
cfg.MinActorAge = 0

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/dan": testResponse{
"https://ip6-allnodes/inbox/dan": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
},
},
"https://ip6-allnodes/inbox/frank": testResponse{
"https://ip6-allnodes/inbox/frank": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -1113,13 +1113,13 @@ func TestDeliver_ToAndCCDuplicates(t *testing.T) {
cfg.MinActorAge = 0

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/dan": testResponse{
"https://ip6-allnodes/inbox/dan": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
},
},
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -1189,7 +1189,7 @@ func TestDeliver_ToAndCCDuplicates(t *testing.T) {
assert.NoError(err)

client.Data = map[string]testResponse{
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -1221,13 +1221,13 @@ func TestDeliver_PublicInTo(t *testing.T) {
cfg.MinActorAge = 0

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/dan": testResponse{
"https://ip6-allnodes/inbox/dan": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
},
},
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -1297,7 +1297,7 @@ func TestDeliver_PublicInTo(t *testing.T) {
assert.NoError(err)

client.Data = map[string]testResponse{
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -1329,13 +1329,13 @@ func TestDeliver_AuthorInTo(t *testing.T) {
cfg.MinActorAge = 0

client := newTestClient(map[string]testResponse{
"https://ip6-allnodes/inbox/dan": testResponse{
"https://ip6-allnodes/inbox/dan": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
},
},
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down Expand Up @@ -1405,7 +1405,7 @@ func TestDeliver_AuthorInTo(t *testing.T) {
assert.NoError(err)

client.Data = map[string]testResponse{
"https://ip6-allnodes/inbox/erin": testResponse{
"https://ip6-allnodes/inbox/erin": {
Response: &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte(`{}`))),
Expand Down
2 changes: 1 addition & 1 deletion fed/followers.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (f partialFollowers) Digest(ctx context.Context, db *sql.DB, domain string,
func (l *Listener) handleFollowers(w http.ResponseWriter, r *http.Request) {
name := r.PathValue("username")

sender, err := l.verify(r.Context(), r, nil, ap.InstanceActor)
sender, err := l.verify(r, nil, ap.InstanceActor)
if err != nil {
slog.Warn("Failed to verify followers request", "error", err)
w.WriteHeader(http.StatusUnauthorized)
Expand Down
2 changes: 1 addition & 1 deletion fed/inbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (l *Listener) handleInbox(w http.ResponseWriter, r *http.Request) {
flags |= ap.Offline
}

sender, err := l.verify(r.Context(), r, body, flags)
sender, err := l.verify(r, body, flags)
if err != nil {
if errors.Is(err, ErrActorGone) {
w.WriteHeader(http.StatusOK)
Expand Down
Loading

0 comments on commit 0923612

Please sign in to comment.