tenseleyflow/shithub / 47c7bba

Browse files

api/issues: drop ad-hoc context alias for plain context.Context

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
47c7bbad947f65e4701f36e6f973dd325cb52aff
Parents
446661f
Tree
1ec52a4

1 changed file

StatusFile+-
M internal/web/handlers/api/issues.go 2 14
internal/web/handlers/api/issues.gomodified
@@ -3,6 +3,7 @@
33
 package api
44
 
55
 import (
6
+	"context"
67
 	"encoding/json"
78
 	"errors"
89
 	"net/http"
@@ -188,7 +189,7 @@ func normalizeIssueState(s string) pgtype.Text {
188189
 	}
189190
 }
190191
 
191
-func (h *Handlers) labelNamesFor(ctx httpRequestCtx, issueID int64) []string {
192
+func (h *Handlers) labelNamesFor(ctx context.Context, issueID int64) []string {
192193
 	rows, err := issuesdb.New().ListLabelsOnIssue(ctx, h.d.Pool, issueID)
193194
 	if err != nil {
194195
 		return nil
@@ -200,19 +201,6 @@ func (h *Handlers) labelNamesFor(ctx httpRequestCtx, issueID int64) []string {
200201
 	return out
201202
 }
202203
 
203
-// httpRequestCtx is a tiny alias used only as a parameter type so the
204
-// labelNamesFor signature reads naturally (we don't want to import net.
205
-// or context in this file just for that). We rely on Go assigning the
206
-// request context to context.Context via the implicit interface.
207
-type httpRequestCtx = ctxLike
208
-
209
-type ctxLike interface {
210
-	Deadline() (time.Time, bool)
211
-	Done() <-chan struct{}
212
-	Err() error
213
-	Value(any) any
214
-}
215
-
216204
 // ─── single get ─────────────────────────────────────────────────────
217205
 
218206
 func (h *Handlers) issueGet(w http.ResponseWriter, r *http.Request) {