API consolidation: context-first, iter.Seq walkers, slog#53
Merged
Conversation
epk
force-pushed
the
structural-modernize
branch
from
March 12, 2026 17:07
08c8335 to
9d72ba1
Compare
epk
force-pushed
the
structural-modernize
branch
from
March 12, 2026 18:01
044af52 to
0968d99
Compare
epk
force-pushed
the
structural-modernize
branch
2 times, most recently
from
March 12, 2026 18:26
e16ded8 to
2a8007b
Compare
jpfourny
reviewed
Mar 12, 2026
| package main | ||
|
|
||
| import ( | ||
| "context" |
There was a problem hiding this comment.
You can just delete this file. The cached leaves walker was removed a while ago - this example should have been removed, too.
jpfourny
approved these changes
Mar 12, 2026
Comprehensive modernization targeting Go 1.26. Breaking API change that removes ~32 redundant API surface points. Conn: remove all non-Ctx wrapper methods, rename FooCtx → Foo. Every public Conn method now takes context.Context as first parameter. Lock: remove Lock/LockCtx, Unlock/UnlockCtx redundancy. Lock(ctx), Unlock(ctx), LockWithData(ctx, data) are the only forms. Tree walkers: add iter.Seq-based All(ctx) alongside callback-based Walk(ctx, visitor). Remove WalkChan, WalkChanCtx, VisitEvent. Other: remove deprecated ConnectWithDialer, replace log with log/slog, update GitHub Actions, remove tools/ module (linter via go tool), adopt Go 1.26 features (range over func, sync.OnceFunc, etc). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
epk
force-pushed
the
structural-modernize
branch
from
March 12, 2026 20:36
2a8007b to
4b251ab
Compare
Member
Author
|
Tested with the CoreDNS MCS plugin, compiles and runs fine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Breaking API change that removes ~32 redundant surface points and modernizes the codebase. Net -279 lines across 24 files.
Conn: remove non-Ctx wrappers, rename FooCtx → Foo
Every Conn method existed as both
Foo()andFooCtx(ctx, ...). Delete the wrappers, renameFooCtxtoFoo. All 22 public Conn methods now takecontext.Contextas first parameter:AddAuth,AddWatch,RemoveWatch,Children,ChildrenW,Get,GetW,Set,Create,CreateContainer,CreateTTL,CreateProtectedEphemeralSequential,Delete,Exists,ExistsW,GetACL,SetACL,Sync,Multi,MultiRead,IncrementalReconfig,ReconfigLock: same consolidation
Lock(ctx)/Unlock(ctx)/LockWithData(ctx, data)— removedLockCtx,UnlockCtx,LockWithDataCtxTree walkers: add iter.Seq, remove channel-based APIs
Add
All(ctx) → (iter.Seq, func() error)for iterator-based traversal. KeepWalk(ctx, visitor)for error-aware callback traversal. RemoveWalkChan,WalkChanCtx, andVisitEventstruct.TreeWalker.All(ctx) → (iter.Seq2[string, *Stat], func() error)TreeWalker.Walk(ctx, VisitorFunc) → errorBatchTreeWalker.All(ctx) → (iter.Seq[string], func() error)BatchTreeWalker.Walk(ctx, BatchVisitorFunc) → errorRemoved types:
VisitorCtxFunc,BatchVisitorCtxFunc,VisitEventRemoved deprecated APIs
ConnectWithDialer— useConnect(..., WithDialer(...))Logger: log → log/slog
Conn.loggeris now*slog.Logger(was customLoggerinterface)WithLoggeraccepts*slog.LoggerSetLoggeraccepts*slog.LoggerLoggerinterface andDefaultLoggervariabledefaultLoggerstruct from structs.gologger.Printfcalls → structuredslog.Info/slog.ErrorRefreshDNSHostProviderusesslog.Errordirectlylog.Printf→slog.Info/slog.ErrorOther cleanup
Version: replaceLessThan/GreaterThan/Equalimplementations withCompareusingcmp.Comparering_buffer_test.go: useslices.Equalinstead of customslicesEqualhelperutil.go: remove now-unusedslicesEqualfunctiondnshostprovider.go:found := []string{}→var found []stringserver_help_test.go,server_java_test.go,conn.go:%v→%win error wrappingcontext.Background()as first argTest plan
go build ./...go vet ./...go tool golangci-lint rungo fix -diff ./...go test ./...(requires ZK test cluster)🤖 Generated with Claude Code