Decide on renaming internal/log, internal/crypto and internal/types (revive var-naming) #76
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Split out of #61 so the lint-remediation PR does not make a repo-wide
naming decision on its own.
revive'svar-namingrule reports three package-name findings thatcannot be fixed without renaming packages across the whole codebase:
internal/log— "avoid package names that conflict with Go standardlibrary package names" (
log)internal/crypto— same, conflicts with stdlibcryptointernal/types— "avoid meaningless package names"In the lint-remediation work these are suppressed with per-site
//nolint:revivedirectives on the package clauses, because thealternative is a rename that touches nearly every file in the repo and
changes import paths — a design decision for the repo owner, not a
mechanical lint fix.
Context that argues the suppressions are safe today:
lognor stdlibcryptois imported anywhere in therepo.
internal/logonly importslog/slog, which binds theidentifier
slog, so there is no actual shadowing conflict in anyfile.
internal/typesholds the ID/hash/path/credential wrapper types; amore specific name is possible but is a naming call.
Implementation note for whoever picks this up: the directives carry
nolintlintalongsiderevive.revivereports the package-namefailure only once per package directory, on whichever file of the
package the linter happens to process first (revive lints a package's
files concurrently over a map), so the finding can land on any file in
the package. Every file of the affected packages therefore carries the
directive, and
nolintlintis listed so the directives on the filesthat did not win the race are not reported as unused.
Definition of done
keep the current names permanently.
make checkstill exits 0, and the
//nolint:revive,nolintlintdirectives onthe package clauses of
internal/log,internal/cryptoandinternal/typesare removed.existing directives stay as they are.
Manager note — routing this to
sneak, since it is purely a naming call.My recommendation: keep the current names and close this issue, i.e.
option 3 in the definition of done.
Reasoning:
lognor stdlibcryptois imported anywhere in the repo, and
internal/logimportslog/slog, which bindsslog. The rule is guarding against acollision that does not exist here.
internal/packages, so no external consumer can importthem. There is no compatibility cost to renaming later, which means
this is not a 1.0 blocker — I have deliberately left it off the
1.0.0milestone.internal/logandinternal/cryptoare the clearest possible namesfor what they hold. Renaming to something like
vlog/vcryptotosatisfy a linter would make the code worse to read in exchange for
nothing.
The one I would not defend as strongly is
internal/types—"meaningless package name" is a fair hit, and
internal/idsorinternal/idtypeswould describe the ID/hash/path/credential wrappersbetter. But that rename touches a lot of files for a modest readability
gain, and #73 (security review) is scheduled to add tests to that package
soon; churning its name first would create conflicts for no benefit.
So: keep all three, close this, leave the four
//nolint:revive,nolintlintdirectives in place. If you would rather rename
internal/typesspecifically, say so and I will schedule it after #73 lands rather than
before.