Skip to content

update minimum go to 1.26 - #6

Merged
acoshift merged 1 commit into
masterfrom
go-1.26
Aug 30, 2026
Merged

acoshift merged 1 commit into
masterfrom
go-1.26

Conversation

@acoshift

Copy link
Copy Markdown
Owner

Raise the module floor to Go 1.26 and modernize the library to current Go idioms.

Toolchain

  • go.mod and CI matrix: 1.23 → 1.26
  • CI actions: actions/checkout@v5, actions/setup-go@v6, codecov/codecov-action@v5

Modern Go

  • errors.AsType for OKError / *ProtocolError classification
  • reflect.TypeFor instead of comparing Type.String() for handler injection
  • skip grpc call options with Type.IsVariadic() instead of “last arg is a slice”
  • strings.SplitSeq for SSE data lines, for i := range n, any, reflect.Pointer
  • README example uses am.Handler (the old am.Handle did not exist) and a method-aware ServeMux pattern

Behavior changes (v2)

These are intentional, tested, and should be treated as runtime contract updates, not style-only:

  1. Wrapped errors. EncodeError walks the unwrap tree. fmt.Errorf("%w", NewError(...)) is now 200 with the inner JSON; wrapped ErrNotFound is now 400. Previously both were 500 {}.
  2. OKError embeds error. Required for errors.AsType[OKError]. Existing implementers already have Error() because they are returned as error.
  3. WrapError does not re-wrap a value that already unwraps to OKError or *ProtocolError (including custom OKError from UnmarshalForm).
  4. Non-variadic last []T is a real request parameter. Only a variadic last arg is skipped as grpc options. func(items []int) now decodes JSON instead of panicking on Call.

errors.Join still prefers the first OKError in the tree (AsType order).

Modernize the library for Go 1.26 idioms: errors.AsType for wrapped
OKError/ProtocolError, reflect.TypeFor for handler injection, IsVariadic
for grpc options, SplitSeq, and range-over-int.
@acoshift
acoshift merged commit 29b932b into master Aug 30, 2026
2 checks passed
@acoshift
acoshift deleted the go-1.26 branch August 30, 2026 23:59
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.

1 participant