detached 7d67af7

fix: linter — use cliWriteLine, sentinel error in admin middleware

commit
7d67af7cf90d5ccba3ccf18586e9e0b96169490e
author
brice · · 2026-03-23 05:28 UTC
parent
38c0e79
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +8 -8
M internal/adapters/in/cli/auth.go +7 -7
@@ -252,7 +252,7 @@ func runAuthLoginWithToken(ctx context.Context, remoteName, token string, out io
252252 defer cancel()
253253 verified := true
254254 if _, err := client.GetStatus(verifyCtx); err != nil {
255- fmt.Fprintln(out, styles.RenderWarning(fmt.Sprintf("Token verification failed: %v", err)))
255+ _ = cliWriteLine(out, styles.RenderWarning(fmt.Sprintf("Token verification failed: %v", err)))
256256 verified = false
257257 }
258258
@@ -260,10 +260,10 @@ func runAuthLoginWithToken(ctx context.Context, remoteName, token string, out io
260260 return fmt.Errorf("failed to save token: %w", err)
261261 }
262262
263- fmt.Fprintln(out)
264- fmt.Fprintln(out, styles.RenderSuccess(fmt.Sprintf("Token stored for remote '%s'", resolvedName)))
263+ _ = cliWriteLine(out, "")
264+ _ = cliWriteLine(out, styles.RenderSuccess(fmt.Sprintf("Token stored for remote '%s'", resolvedName)))
265265 if verified {
266- fmt.Fprintln(out, styles.RenderSuccess("Token verified with remote status endpoint"))
266+ _ = cliWriteLine(out, styles.RenderSuccess("Token verified with remote status endpoint"))
267267 }
268268 return nil
269269 }
@@ -308,10 +308,10 @@ func runAuthShowToken(remoteName string, out io.Writer) error {
308308 }
309309
310310 if f, ok := out.(*os.File); ok && isatty.IsTerminal(f.Fd()) {
311- fmt.Fprintln(os.Stderr, styles.RenderWarning("Warning: token will be visible in terminal scrollback"))
311+ _ = cliWriteLine(os.Stderr, styles.RenderWarning("Warning: token will be visible in terminal scrollback"))
312312 }
313313
314- fmt.Fprintln(out, token)
314+ _ = cliWriteLine(out, token)
315315 return nil
316316 }
317317
@@ -350,7 +350,7 @@ func runAuthLogout(remoteName string, out io.Writer) error {
350350 return fmt.Errorf("failed to clear token: %w", err)
351351 }
352352
353- fmt.Fprintln(out, styles.RenderSuccess(fmt.Sprintf("Logged out from remote '%s'", resolvedName)))
353+ _ = cliWriteLine(out, styles.RenderSuccess(fmt.Sprintf("Logged out from remote '%s'", resolvedName)))
354354 return nil
355355 }
356356
@@ -252,7 +252,7 @@ func runAuthLoginWithToken(ctx context.Context, remoteName, token string, out io
252 defer cancel()252 defer cancel()
253 verified := true253 verified := true
254 if _, err := client.GetStatus(verifyCtx); err != nil {254 if _, err := client.GetStatus(verifyCtx); err != nil {
255- fmt.Fprintln(out, styles.RenderWarning(fmt.Sprintf("Token verification failed: %v", err)))255+ _ = cliWriteLine(out, styles.RenderWarning(fmt.Sprintf("Token verification failed: %v", err)))
256 verified = false256 verified = false
257 }257 }
258 258
@@ -260,10 +260,10 @@ func runAuthLoginWithToken(ctx context.Context, remoteName, token string, out io
260 return fmt.Errorf("failed to save token: %w", err)260 return fmt.Errorf("failed to save token: %w", err)
261 }261 }
262 262
263- fmt.Fprintln(out)263+ _ = cliWriteLine(out, "")
264- fmt.Fprintln(out, styles.RenderSuccess(fmt.Sprintf("Token stored for remote '%s'", resolvedName)))264+ _ = cliWriteLine(out, styles.RenderSuccess(fmt.Sprintf("Token stored for remote '%s'", resolvedName)))
265 if verified {265 if verified {
266- fmt.Fprintln(out, styles.RenderSuccess("Token verified with remote status endpoint"))266+ _ = cliWriteLine(out, styles.RenderSuccess("Token verified with remote status endpoint"))
267 }267 }
268 return nil268 return nil
269 }269 }
@@ -308,10 +308,10 @@ func runAuthShowToken(remoteName string, out io.Writer) error {
308 }308 }
309 309
310 if f, ok := out.(*os.File); ok && isatty.IsTerminal(f.Fd()) {310 if f, ok := out.(*os.File); ok && isatty.IsTerminal(f.Fd()) {
311- fmt.Fprintln(os.Stderr, styles.RenderWarning("Warning: token will be visible in terminal scrollback"))311+ _ = cliWriteLine(os.Stderr, styles.RenderWarning("Warning: token will be visible in terminal scrollback"))
312 }312 }
313 313
314- fmt.Fprintln(out, token)314+ _ = cliWriteLine(out, token)
315 return nil315 return nil
316 }316 }
317 317
@@ -350,7 +350,7 @@ func runAuthLogout(remoteName string, out io.Writer) error {
350 return fmt.Errorf("failed to clear token: %w", err)350 return fmt.Errorf("failed to clear token: %w", err)
351 }351 }
352 352
353- fmt.Fprintln(out, styles.RenderSuccess(fmt.Sprintf("Logged out from remote '%s'", resolvedName)))353+ _ = cliWriteLine(out, styles.RenderSuccess(fmt.Sprintf("Logged out from remote '%s'", resolvedName)))
354 return nil354 return nil
355 }355 }
356 356
M internal/adapters/in/http/admin/middleware.go +1 -1
@@ -93,7 +93,7 @@ func AuthMiddleware(
9393 Str("subject", claims.Subject).
9494 Str("path", r.URL.Path).
9595 Msg("long-lived token rejected on admin endpoint")
96- sendUnauthorized(w, "long-lived tokens must be exchanged via /auth/token")
96+ sendUnauthorized(w, domain.ErrLongLivedToken.Error())
9797 return
9898 }
9999
@@ -93,7 +93,7 @@ func AuthMiddleware(
93 Str("subject", claims.Subject).93 Str("subject", claims.Subject).
94 Str("path", r.URL.Path).94 Str("path", r.URL.Path).
95 Msg("long-lived token rejected on admin endpoint")95 Msg("long-lived token rejected on admin endpoint")
96- sendUnauthorized(w, "long-lived tokens must be exchanged via /auth/token")96+ sendUnauthorized(w, domain.ErrLongLivedToken.Error())
97 return97 return
98 }98 }
99 99

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close