Skip to content

expfmt: simplify format constants and provide default negotiation slices - #992

Draft
bwplotka wants to merge 1 commit into
mainfrom
expfmt-ergonomics
Draft

bwplotka wants to merge 1 commit into
mainfrom
expfmt-ergonomics

Conversation

@bwplotka

@bwplotka bwplotka commented Sep 22, 2026

Copy link
Copy Markdown
Member

This PR attempts to improve the ergonomics of the expfmt package without breaking backwards compatibility.

NOTE: Still playing with different ways.

Fixes: #993

- Undeprecate Fmt... constants and ProtoFmt, clarifying documentation
  that these represent baseline Content-Types.
- Export FmtOpenMetrics_2_0_0 constant.
- Add Format.Version() to extract format version parameter.
- Add Format.Matches() to safely compare formats while ignoring
  dynamic parameters (e.g. escaping scheme) and whitespace differences.
- Provide DefaultAcceptedFormats, DefaultOpenMetricsAcceptedFormats, and
  DefaultOpenMetrics2AcceptedFormats slices for use with NegotiateAccept.
- Update Negotiate and NegotiateIncludingOpenMetrics to use the new slices.

Signed-off-by: bwplotka <bwplotka@gmail.com>
@bwplotka
bwplotka marked this pull request as draft September 22, 2026 15:56
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.

Improve expfmt.Format with expfmt.NegotiateAccept ergonomics

1 participant