Skip to content

Bump golang version, add io.StringWriter and improve performance#33

Open
boekkooi-impossiblecloud wants to merge 8 commits into
felixge:masterfrom
boekkooi-impossiblecloud:master
Open

Bump golang version, add io.StringWriter and improve performance#33
boekkooi-impossiblecloud wants to merge 8 commits into
felixge:masterfrom
boekkooi-impossiblecloud:master

Conversation

@boekkooi-impossiblecloud
Copy link
Copy Markdown

Good day,

Thanks for reviewing this PR and sorry for the size of it but I wanted to share (and maybe have a chat about it).

The first thing this PR is doing is adding support for io.StringWriter which was introduced in golang 1.12.
It also bumps the supported golang version to 1.25 and up same as the currently supported golang versions.

Finally I started doing some performance improvements by:

  • Invoking each hooks/middleware on creation removing allocations for each Write call.
    This is a change in behavior and could require a v2 version of the library.
  • Defining a type for each variant which allows for zero-cost pointer conversion removing an allocation from Wrap.

Again sorry for the size and thanks for having a look.
I hope some of this maybe useful 😄
Have a great day!

The interface was added to the io package in go 1.12.

 Related to:
 - https://go.dev/doc/go1.12#iopkgio
 - golang/go@33d531d
This removes allocation for each Write call
A type is now created for each possible interface combination. Allowing Wrap to so a single allocation.
@felixge
Copy link
Copy Markdown
Owner

felixge commented May 23, 2026

Thanks this looks great. I only found one issue. If you apply this change to your PR I'll go ahead and merge: boekkooi-impossiblecloud#1

@boekkooi-impossiblecloud
Copy link
Copy Markdown
Author

Hey @felixge,

Thanks a lot for the review! Your against this one is merged 😄

Please let me know if anything else is needed.
Have a great weekend!

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