Skip to content

fix: Get rid of deprecated x/net/http2/h2c#7424

Merged
Sovietaced merged 1 commit into
flyteorg:mainfrom
alexandear-org:refactor/remove-h2c
May 26, 2026
Merged

fix: Get rid of deprecated x/net/http2/h2c#7424
Sovietaced merged 1 commit into
flyteorg:mainfrom
alexandear-org:refactor/remove-h2c

Conversation

@alexandear
Copy link
Copy Markdown
Contributor

@alexandear alexandear commented May 26, 2026

Why are the changes needed?

Go 1.25 added native support for unencrypted HTTP/2 (h2c) directly in the standard net/http. This PR removes the dependency on the deprecated package golang.org/x/net/http2/h2c.

What changes were proposed in this pull request?

  1. Replaced golang.org/x/net/http2/h2c usage with the native Go 1.25 http.Protocols API in two places:
  • flytestdlib/app/app.go
  • runs/test/api/setup_test.go
  1. Enabled the depguard linter in flytestdlib/.golangci.yml to prevent future regressions.

How was this patch tested?

Both files compile cleanly with go build. The behavior is equivalent - the server continues to accept both HTTP/1.1 and unencrypted HTTP/2 connections.

curl -i --http2-prior-knowledge http://localhost:8090

Labels

  • changed

Setup process

Screenshots

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Stack

Docs link

https://pkg.go.dev/golang.org/x/net/http2/h2c - deprecated package being replaced

Copilot AI review requested due to automatic review settings May 26, 2026 14:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR removes the x/net/http2/h2c handler wrapper and switches to configuring HTTP protocol support via net/http’s Server.Protocols, aiming to reduce direct dependencies on golang.org/x/net.

Changes:

  • Replaced h2c.NewHandler(..., &http2.Server{}) with plain handlers plus Server.Protocols configuration.
  • Moved golang.org/x/net from a direct to an indirect go.mod dependency.
  • Updated inline documentation to remove references to h2c framing.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
runs/test/api/setup_test.go Replaces h2c-wrapped test server handler with protocol configuration on http.Server.
go.mod Drops direct requirement on golang.org/x/net, retaining it indirectly.
flytestdlib/app/app.go Updates production server wiring to use Server.Protocols instead of x/net/http2/h2c and tweaks related comments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread flytestdlib/app/app.go Outdated
Comment thread runs/test/api/setup_test.go Outdated
Comment thread flytestdlib/app/app.go Outdated
@alexandear alexandear force-pushed the refactor/remove-h2c branch from 2cc94d9 to b1ecf68 Compare May 26, 2026 14:32
Copilot AI review requested due to automatic review settings May 26, 2026 14:47
@alexandear alexandear force-pushed the refactor/remove-h2c branch from b1ecf68 to 6cde04b Compare May 26, 2026 14:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread flytestdlib/app/app.go Outdated
Comment thread flytestdlib/app/app.go Outdated
Comment thread flytestdlib/.golangci.yml
@alexandear alexandear force-pushed the refactor/remove-h2c branch from 6cde04b to ef4c9d7 Compare May 26, 2026 15:09
Comment thread flytestdlib/app/app.go Outdated
Copilot AI review requested due to automatic review settings May 26, 2026 18:37
Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
@alexandear alexandear force-pushed the refactor/remove-h2c branch from 3ca3358 to c761d47 Compare May 26, 2026 18:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread flytestdlib/app/app.go
Comment thread flytestdlib/app/app.go
Comment thread flytestdlib/.golangci.yml
@Sovietaced Sovietaced merged commit c7d2b07 into flyteorg:main May 26, 2026
21 checks passed
@alexandear alexandear deleted the refactor/remove-h2c branch May 26, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants