tenseleyflow/shithub / b6ae85d

Browse files

drop empty branch + now-unused imports in resolve.go

Authored by espadonne
SHA
b6ae85d3dd1d0dd852f8c518f677dea3fd1a9990
Parents
c4fc34f
Tree
ee7896a

1 changed file

StatusFile+-
M internal/repos/identity/resolve.go 12 14
internal/repos/identity/resolve.gomodified
@@ -15,11 +15,9 @@ import (
1515
 	"context"
1616
 	"crypto/md5" //nolint:gosec // identicon hash, not a security primitive
1717
 	"encoding/hex"
18
-	"errors"
1918
 	"strings"
2019
 	"sync"
2120
 
22
-	"github.com/jackc/pgx/v5"
2321
 	"github.com/jackc/pgx/v5/pgxpool"
2422
 
2523
 	usersdb "github.com/tenseleyFlow/shithub/internal/users/sqlc"
@@ -35,22 +33,22 @@ import (
3533
 // unverified row. The handler should render the raw author name with
3634
 // a deterministic identicon fallback (IdenticonSeed).
3735
 type Resolved struct {
38
-	User           bool
39
-	UserID         int64
40
-	Username       string
41
-	DisplayName    string
42
-	AvatarURL      string
43
-	IdenticonSeed  string
36
+	User          bool
37
+	UserID        int64
38
+	Username      string
39
+	DisplayName   string
40
+	AvatarURL     string
41
+	IdenticonSeed string
4442
 }
4543
 
4644
 // Resolver resolves emails. Per-request memoization keeps a commits-
4745
 // list page (30 commits, often one author) to one DB query. Construct
4846
 // per request; do not share across requests.
4947
 type Resolver struct {
50
-	pool   *pgxpool.Pool
51
-	q      *usersdb.Queries
52
-	cache  map[string]Resolved
53
-	mu     sync.Mutex
48
+	pool  *pgxpool.Pool
49
+	q     *usersdb.Queries
50
+	cache map[string]Resolved
51
+	mu    sync.Mutex
5452
 }
5553
 
5654
 // New returns a fresh resolver tied to a pgx pool. Pass nil pool only
@@ -91,9 +89,9 @@ func (r *Resolver) Resolve(ctx context.Context, email string) Resolved {
9189
 				out.DisplayName = user.DisplayName
9290
 				out.AvatarURL = "/avatars/" + user.Username
9391
 			}
94
-		} else if err != nil && !errors.Is(err, pgx.ErrNoRows) {
95
-			// log? handler-side concern; we just fall through.
9692
 		}
93
+		// Non-ErrNoRows errors fall through silently — logging is the
94
+		// handler's call, the resolver just doesn't fill the row.
9795
 	}
9896
 
9997
 	r.mu.Lock()