login: fix lint (errcheck blank-assign, ireturn) · Entire

login: fix lint (errcheck blank-assign, ireturn)

49a77a8→main·

toothbrush·1mo ago·2 files·+12 added/-2 removed

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Sessions

a0b237ab3218View transcript

[?
Switch Login Flow to Browser-Based DefaultClaude Code·1 step](/content/gh/entireio/cli/session/5d3033e2-31cd-46be-999c-6ae099f4757a#timeline-a0b237ab3218/index.html)

Changes

2

135 unmodified lines

136
137
138
139
140
141
142
143

135 unmodified lines

// StartBrowserAuth begins the loopback authorization-code flow: it binds a
// local listener and returns a flow carrying the browser URL to open.
//
//nolint:ireturn // returns the BrowserAuthFlow interface deliberately so login.go can substitute a fake in tests; the concrete impl owns a live listener and stays unexported.
func (c *Client) StartBrowserAuth(ctx context.Context) (BrowserAuthFlow, error) {
f, err := c.browser.Start(ctx)
if err != nil {

Mcmd/entire/cli/auth/client.go+2

334 unmodified lines

335
336
337
338
339
340
341
48 unmodified lines

390
391
392
392
393
394
395
396
397
398
399
400
401
22 unmodified lines

424
425
426
421
427
428
429
430
431
432

334 unmodified lines

startErr error
}

//nolint:ireturn // mirrors the browserAuthClient interface, which returns the auth.BrowserAuthFlow interface by design.
func (c *fakeBrowserClient) StartBrowserAuth(context.Context) (auth.BrowserAuthFlow, error) {
if c.startErr != nil {
return nil, c.startErr
48 unmodified lines

}

var out bytes.Buffer
_ = runBrowserLogin(context.Background(), &out, &bytes.Buffer{}, client, openURL)
// The stubbed Wait returns an error, so runBrowserLogin stops before
// persistLogin (which would hit the real keyring); we assert on the
// side effects up to that point.
if err := runBrowserLogin(context.Background(), &out, &bytes.Buffer{}, client, openURL); err == nil {
t.Fatal("expected error from stubbed Wait")
}

if openedURL != flow.authURL {
t.Errorf("opened URL = %q, want %q", openedURL, flow.authURL)
22 unmodified lines

failOpen := func(context.Context, string) error { return errors.New("no browser") }

var out, errW bytes.Buffer
_ = runBrowserLogin(context.Background(), &out, &errW, client, failOpen)
if err := runBrowserLogin(context.Background(), &out, &errW, client, failOpen); err == nil {
t.Fatal("expected error from stubbed Wait")
}

if !strings.Contains(errW.String(), "failed to open browser") {
t.Errorf("stderr missing warning:\n%s", errW.String())