You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove need for consumer replace directive on urfave/sflags fork #17
dioad/cli imports github.com/urfave/sflags, and consumers pick up a patched fork through a replace directive in their own go.mod. dioad/connect does this:
The fork's go.mod still declares module github.com/urfave/sflags, so the fork can't be required under its own path, and every consumer has to carry the replace. This causes two problems:
go install stops working.replace directives are ignored in dependencies and refused by go install module@version, so a consumer that needs the fix can't be installed with go install github.com/dioad/connect@latest.
Builds can silently differ. A consumer that forgets the replace builds against upstream urfave/sflags without the patch, with no error.
This was found in the dioad/connect architecture review, finding 82 in doc/claude-review-architecture.md. connect's other replace, emersion/go-smtp pointing to dioad/go-smtp, has the same shape but is connect's own concern.
Proposal
Pick one:
Upstream the patch to urfave/sflags and drop the fork. This is best if it's acceptable upstream.
Give the fork its own module path. Change the fork's go.mod to module github.com/patdowney/sflags (or move it under github.com/dioad/), tag it, and import that path from dioad/cli (command.go: sflags, sflags/gen/gpflag). Consumers can then delete their replace.
Either way, document in the cli README which sflags behaviour dioad/cli depends on, so the reason for the fork isn't lost.
Follow-up in consumers
Once released, bump dioad/cli in dioad/connect and remove the sflags replace from its go.mod.
The fork's only change (the InheritHidden() / InheritDeprecated() options) was merged upstream as urfave/sflags@b88b11ddd16a, with the same API. Upstream main hasn't been tagged since v0.4.1.
Commit 92fee7b on branch fix/sflags-upstream (local, not pushed):
Requires github.com/urfave/sflags v0.4.2-0.20250718033027-b88b11ddd16a and drops the replace. The pseudo-version sorts above v0.4.1, so consumers get the fix through normal version selection with no replace of their own.
Adds TestNewCommand_NestedFlagsInheritParentTags. It pins the behaviour consumers depend on: a hidden or deprecated tag on a struct field applies to every flag generated from its fields. Nothing tested this before.
make verify passes with GOWORK=off.
Remaining steps
Merge and tag a dioad/cli release.
In dioad/connect: bump dioad/cli and delete the sflags replace from go.mod.
Optional: once upstream tags v0.4.2, move from the pseudo-version to the tag.
Activity
patdowney commentedon Nov 4, 2026
Approach taken: upstream pseudo-version, no fork
The fork's only change (the
InheritHidden()/InheritDeprecated()options) was merged upstream as urfave/sflags@b88b11ddd16a, with the same API. Upstreammainhasn't been tagged sincev0.4.1.Commit 92fee7b on branch
fix/sflags-upstream(local, not pushed):github.com/urfave/sflags v0.4.2-0.20250718033027-b88b11ddd16aand drops thereplace. The pseudo-version sorts abovev0.4.1, so consumers get the fix through normal version selection with noreplaceof their own.b88b11drather thanmainHEAD. HEAD also includes the laterstrings.SplitNvalue-splitting change (Use SplitN for map flags to support values containing separators urfave/sflags#45), which should be adopted deliberately rather than as a side effect.TestNewCommand_NestedFlagsInheritParentTags. It pins the behaviour consumers depend on: ahiddenordeprecatedtag on a struct field applies to every flag generated from its fields. Nothing tested this before.make verifypasses withGOWORK=off.Remaining steps
dioad/clirelease.dioad/cliand delete the sflagsreplacefromgo.mod.v0.4.2, move from the pseudo-version to the tag.