Skip to content

v1.3.0

Choose a tag to compare

@github-actions github-actions released this 30 Apr 16:15
895ed6e

Adds etag.WithAutoKeyScope so a single *http.Client can serve
multiple tenants without provisioning N transports. Elevates GraphQL/v4
to first-class billing in the docs: the generic factory already worked
with shurcooL/githubv4, but the lead documentation framed the kit as
a google/go-github (REST) wrapper. No new runtime dependencies in
the root module.

Added

  • etag.WithAutoKeyScope(fn func(*http.Request) (string, error)): derives
    the cache-key scope per request. Mutually exclusive with
    etag.WithKeyScope; combining both yields etag.ErrConflictingScope.
    Either option satisfies the caller-supplied-Cache scope requirement.
  • etag.ErrEmptyScope: sentinel wrapped and returned from RoundTrip
    when the fn returns an empty string with a nil error. The contract is
    "non-empty scope or non-nil error"; the empty + nil combination is a
    programming error, not a bypass signal.
  • etag.ErrConflictingScope: sentinel surfaced at construction when both
    WithKeyScope and WithAutoKeyScope are set.

Documentation

  • doc.go lead paragraph rewritten to name both google/go-github (REST)
    and shurcooL/githubv4 (GraphQL) as canonical factories. New
    paragraphs document GraphQL/v4 compatibility (etag layer no-ops on
    POST; v4 traffic flows through oauth2 + retry + ratelimit + throttle
    • UA without ETag caching) and custom cache backends via the
      three-method etag.Cache interface.
  • README.md lead paragraph elevates GraphQL/v4 to first-class billing.
    New recipes: "Recommended setup for a long-lived service",
    "GraphQL with shurcooL/githubv4", "Multi-tenant single client (one
    Transport, many installations)".
  • MIGRATION.md Recipe 2 cross-references WithAutoKeyScope for the
    multi-installation single-transport pattern.

Examples

  • examples/installation-token/main.go replaces the
    oauth2.StaticTokenSource stand-in with an inline
    bradleyfalzon/ghinstallation/v2 to oauth2.TokenSource adapter
    (the canonical local-key JWT signing path).
  • New examples/graphql-v4/ runs a minimal Viewer.Login query through
    shurcooL/githubv4 over a ghkit-built *http.Client. Pins compile-time
    compatibility with the v4 SDK in the examples CI lane.

Dependencies

No changes in the root module. The examples/ module gains
bradleyfalzon/ghinstallation/v2, golang-jwt/jwt/v4 (transitive),
shurcooL/githubv4, and shurcooL/graphql (transitive).