Remove deprecated WithBaseOption wrapper function (#57) - #102
harrydayexe merged 3 commits into
Conversation
WithBaseOption was deprecated in favour of BaseOption.AsGeneratorOption, which all call sites already use. Remove it now that the public API can break, and cover the replacement method directly in pkg/config. BREAKING CHANGE: config.WithBaseOption has been removed. Call BaseOption.AsGeneratorOption() on the base option instead, e.g. config.WithLogger(logger).AsGeneratorOption(). Refs #57 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
With WithBaseOption gone, BaseOption.AsGeneratorOption and its siblings are the only way to pass a BaseOption to a constructor. The package overview described BaseOption flowing into the specialised option types but never named the methods that do the lifting, so add them to the "Option types" section with a worked example for each. Refs #57 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The godoc examples for WithBlogRoot and WithLogger passed a BaseOption straight into generator.New and watcher.New, which only accept GeneratorOption and WatcherOption. With WithBaseOption removed, AsGeneratorOption and AsWatcherOption are the only route, so the examples now show them and compile as written. Also correct the WithBlogRoot doc comment, which said it returns an "Option" rather than a BaseOption. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Automated reviewI read the diff, the full The removal itself is correct and complete: no remaining reference to One finding:
Agent responsePushed to Review points1. Non-compiling godoc examples at The reviewer is correct on all three. I confirmed the signatures: Changes:
Beyond the three lines, I swept the whole repo (all file types, not just I also corrected one thing adjacent to the fix: Verification
Nothing declined. Posted by rain. Both halves were written by Claude Code; treat them as a starting point for human review, not a substitute for it. |
Closes #57
Note
This pull request was written by rain running Claude Code. It has not been reviewed by a human. CI and an automated review pass run before it is handed over.
It targets
v3-changesrather than the default branch:57-remove-deprecated-withbaseoption-wrapper-functionwas already linked to the issue, and its history says it was cut fromv3-changes.Issue
#57: Remove deprecated WithBaseOption wrapper function
What the agent reports
Pushed. Branch is two commits ahead of
v3-changes.What changed
78c3c5a— the removal (pre-existing on the branch, verified not re-done). Deletesfunc WithBaseOption(BaseOption) GeneratorOptionfrompkg/config/generatorOption.goand addspkg/config/generatorOption_test.gocovering the replacementBaseOption.AsGeneratorOption()— that it lifts logger, blog root and assets dir, and that it leaves the generator-specific func pointers nil so theelse ifapplication chain can't pick a field the caller never set.204588f— doc follow-up I added.pkg/config/doc.go's "Option types" section saidBaseOptionflows into the specialised types "via the embedded BaseOption" but never named the methods that do the lifting. With the wrapper gone,As*Option()is the only route, so the package overview described a capability with no stated way to reach it. Added a short paragraph namingAsGeneratorOption/AsWatcherOption/AsServerOptionwith one example each. This is theCLAUDE.mdrule that API changes carry doc updates; I kept it to the one surface the removal actually invalidated.Verification
grepforWithBaseOptionacross all*.goand*.md: no matches anywhere in the repo, so no dangling call sites or stale docs..github/workflows/test.ymlruns vet + test +-raceper module):go vet ./...,go test ./...andgo test -race ./...all pass for both.andcli.go vet ./...passes forintegration(its tests need Docker and were not run).gofmt -l .clean.go doc ./pkg/configrenders the new section correctly.-count=1(not just cached).addlicense -checkcould not run — the binary isn't installed in this environment. The new test file carries the MPL header matching its siblings, anddoc.gowas edited in place, so the license check should pass.For the reviewer
Two things worth a look:
The doc examples are hand-verified, not compiled. I initially wrote
server.New(cfg, config.WithLogger(logger).AsServerOption()), which is wrong —server.Newtakes(posts fs.FS, opts config.ServerConfig), not variadic options. I checked the real signatures and corrected it to construct aServerConfigwith aServer: []config.BaseServerOption{...}field. Thegenerator.Newandwatcher.Newexamples match their actual signatures. Since these live in comments nothing enforces them, so a second read is worthwhile.Scope judgement. The issue names only
WithBaseOption. I did not touch the siblingAs*Optionmethods or theAsOption()methods on the individual config types. The doc paragraph is the sole addition beyond the literal removal.The commit message on
78c3c5aalready carries aBREAKING CHANGE:footer, which matters if release tooling derives the v3.0.0 notes from commit trailers.Changelog (#102)
📚 Documentation
❓ Uncategorised!