Consolidate appname to internal/globals as a constant #34
Reference in New Issue
Block a user
Delete Branch "consolidate-appname-to-globals"
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?
Closes issue #30.
The appname
"pixad"was redundantly defined in bothcmd/pixad/main.go(as a package-level var) andinternal/globals/globals.go(as a package-level var that got copied from main). Since the appname is always"pixad"and is not actually set via ldflags (onlyVersionis), this PR:appnameonce as an unexported constant ininternal/globals/globals.goAppnamevar fromcmd/pixad/main.goglobals.Appname = Appnameassignment frommain.run()Versionflow unchanged (still set via ldflags in main, passed to globals)The
Globals.Appnamestruct field remains available to all consumers — they just get it from the constant now instead of a package var that was always"pixad".All existing tests pass,
docker build .succeeds.Review: PR #34 — Consolidate appname to internal/globals as a constant
Policy Compliance
.golangci.yml,Makefile,Dockerfile, CI config, or test assertionscmd/pixad/main.go,internal/globals/globals.go) — tightly scopedgo.mod/go.sumunchanged (no dependency changes)Requirements Checklist (issue #30)
Issue: "Appname doesn't need to be in main and internal/globals both"
Appnamevar removed fromcmd/pixad/main.goglobals.Appname = Appnameassignment removed frommain.run()appnamedefined once as an unexported constant ininternal/globals/globals.goGlobals.Appnamestruct field still populated correctly (from the constant)globals.Appname(logger, config, healthcheck, server/sentry) continue to work unchanged via theGlobalsstructVersionldflags flow completely unchanged (Makefile:-X main.Version, Dockerfile:-X main.Version=${VERSION})Build Result
docker build .— PASS (fmt-check ✅, lint ✅, all tests ✅, binary build ✅)Rebase
Branch
consolidate-appname-to-globalsis already up to date withmain.Verdict: PASS
Clean, minimal change that does exactly what the issue asks — eliminates the redundant
Appnamevariable in main by making it a constant in globals. No behavioral change, no scope creep.