Skip to content

Fix deprecated API lint findings - #312

Merged
williammartin merged 2 commits into
trunkfrom
williammartin-fix-pre-existing-lint-issues
Oct 9, 2026
Merged

williammartin merged 2 commits into
trunkfrom
williammartin-fix-pre-existing-lint-issues

Conversation

@williammartin

@williammartin williammartin commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Description

Fixes the 4 golangci-lint findings on trunk, which all come from deprecated standard library APIs:

  • reflect.Ptr → reflect.Pointer in pkg/x/markdown/accessibility_test.go.
  • http.Transport.Dial/DialTLS → DialContext/DialTLSContext in pkg/api/http_client.go.

The second fix changes the transport go-gh uses when http_unix_socket is configured. In that setup, every request goes to a local unix socket instead of the network. No test covered this, so I added two tests, one for each dialer. Each starts a small HTTP server on a unix socket and requests a URL whose host can't resolve, so a response can only come from that server. One test requests an http:// URL, which uses DialContext. The other requests an https:// URL, which uses DialTLSContext and must reach the socket as plain HTTP.

How did you test this change?

I ran golangci-lint run ./... and saw the 4 findings before the change and 0 issues. after it. The new tests pass both before and after the fix. When I removed DialContext, only the http:// test failed. When I removed DialTLSContext, only the https:// test failed.

Key points

The tests put their sockets in os.MkdirTemp instead of t.TempDir(), because macOS limits socket paths to 104 bytes and the t.TempDir() path is longer.

Notes for reviewers

CI lints with golangci-lint v2.6.0, which may not report these findings. I found them with v2.14.0.

Authorship and follow-up

Who wrote this:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @williammartin will read and reply directly.
  • An agent will draft replies and @williammartin will read them before they are posted.
  • Nobody has explicitly committed to replying.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused API migrations preserve intended behavior and are adequately covered by the new transport test.

0 open findings

What changed in this PR

Updates deprecated Go APIs while preserving Unix-domain socket transport behavior.

Changes:

  • Replaces deprecated reflection constants.
  • Migrates HTTP transport dialers to context-aware APIs.
  • Adds HTTP/HTTPS Unix socket coverage.
File Description
pkg/​x/​markdown/​accessibility_test.go Uses reflect.Pointer.
pkg/​api/​http_client.go Uses context-aware socket dialers.
pkg/​api/​http_client_test.go Tests Unix socket routing.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@williammartin
williammartin marked this pull request as ready for review October 8, 2026 17:37
@williammartin
williammartin requested a review from a team as a code owner October 8, 2026 17:37
@williammartin
williammartin requested review from a team, BagToad and tidy-dev and removed request for a team and tidy-dev October 8, 2026 17:37
@williammartin
williammartin merged commit 92d8a75 into trunk Oct 9, 2026
11 checks passed
@williammartin
williammartin deleted the williammartin-fix-pre-existing-lint-issues branch October 9, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants