Skip to content

Upgrade connect-go v2 - #89

Merged
emcfarlane merged 2 commits into
mainfrom
ed/v2
Sep 28, 2026
Merged

emcfarlane merged 2 commits into
mainfrom
ed/v2

Conversation

@emcfarlane

@emcfarlane emcfarlane commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

This PR prepares for connect-go v2. It imports the latest v2 release. See: https://github.com/connectrpc/connectgo/releases/tag/v2.0.0-alpha.1

The module path is updated to connectrpc.com/grpchealth/v2.

API changes

NewHandler is replaced by Register. In v2, services are registered on a connect.Server rather than mounted on an http.ServeMux, so the returned path and http.Handler are gone, along with the internal mux. Handler options are no longer accepted here. Configure them on connect.NewServer instead.

NewClient now takes a constructed *connect.Client. The base URL, protocol, and client options move to the transport, so connecthttp.WithGRPC replaces connect.WithGRPC.

Checker, Watcher, StaticChecker, CheckRequest, CheckResponse, Status, and WatchEvent are unchanged. Health-checking behavior, error codes, and wire compatibility with Google's gRPC implementations are unchanged.

Migration

-mux.Handle(grpchealth.NewHandler(checker))
+connectServer := connect.NewServer()
+grpchealth.Register(connectServer, checker)
+connecthttp.Mount(mux, connectServer)
-client := grpchealth.NewClient(httpClient, "https://api.example.com", connect.WithGRPC())
+client := grpchealth.NewClient(connect.NewClient(connecthttp.NewTransport(
+    httpClient,
+    "https://api.example.com",
+    connecthttp.WithGRPC(),
+)))

Signed-off-by: Edward McFarlane <emcfarlane@buf.build>
@emcfarlane
emcfarlane marked this pull request as ready for review September 22, 2026 20:02
@emcfarlane
emcfarlane requested review from jhump and pkwarren and removed request for jhump September 25, 2026 18:57
Signed-off-by: Edward McFarlane <emcfarlane@buf.build>
emcfarlane added a commit to connectrpc/connectrpc.com that referenced this pull request Sep 28, 2026
This adds a vanity import path for as part of [connect-go
v2](connectrpc/connect-go#951) for modules
`connectrpc.com/grpchealth/v2` and `connectrpc.com/grpcreflect/v2`.

Related to #402 and
#383

Depends on connectrpc/grpcreflect-go#99 and
connectrpc/grpchealth-go#89

Signed-off-by: Edward McFarlane <emcfarlane@buf.build>
@emcfarlane
emcfarlane merged commit 7caca4e into main Sep 28, 2026
4 checks passed
@emcfarlane
emcfarlane deleted the ed/v2 branch September 28, 2026 17:30
@emcfarlane emcfarlane mentioned this pull request Oct 7, 2026
emcfarlane added a commit that referenced this pull request Oct 7, 2026
This prepares for the v2.0.0 release of `connectrpc.com/grpchealth/v2`.
Below are the proposed release notes:

## What's new in version 2

grpchealth-go v2 is built for [connect-go
v2](https://github.com/connectrpc/connect-go/releases/tag/v2.0.0). The
module path is now `connectrpc.com/grpchealth/v2`. Health-checking
behavior, error codes, and wire compatibility with Google's gRPC
implementations are unchanged. v1 is still supported for connect-go v1,
and because the module paths differ, you can use both in the same
module.

The health service now registers on a `connect.Server` instead of
returning an `http.Handler`, and the client takes a `*connect.Client`:

```diff
-mux.Handle(grpchealth.NewHandler(checker))
+connectServer := connect.NewServer()
+grpchealth.Register(connectServer, checker)
+connecthttp.Mount(mux, connectServer)
```

```diff
-client := grpchealth.NewClient(httpClient, "https://api.example.com", connect.WithGRPC())
+client := grpchealth.NewClient(connect.NewClient(connecthttp.NewTransport(
+     httpClient,
+     "https://api.example.com",
+     connecthttp.WithGRPC(),
+)))
```

`Checker`, `Watcher`, `StaticChecker`, `CheckRequest`, `CheckResponse`,
`Status`, and `WatchEvent` are unchanged. The [v2 migration
guide](https://github.com/connectrpc/connect-go/blob/v2.0.0/docs/v2-migration.md#grpchealth)
covers the change, and the `connect-go-v2-migrate` tool rewrites both
forms automatically. See #89 for details.

To upgrade, run:

```bash
go get connectrpc.com/grpchealth/v2@v2.0.0
```

**Full Changelog**:
v1.5.0...v2.0.0

Signed-off-by: Edward McFarlane <emcfarlane@buf.build>
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.

2 participants