Extract template functions into their own package #159
Labels
No labels
Agent/Chrome-Android
Agent/Chrome-Desktop
Agent/Chrome-iOS
Agent/Firefox-Android
Agent/Firefox-Desktop
Agent/Firefox-iOS
Agent/Safari-Desktop
Agent/Safari-iOS
Code/Backend
Code/DB
Code/DevOps
Code/Frontend
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
overdrives/chambersbr#159
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
About 150 lines of main.go are the template FuncMap plus ptMonths, ptMonthsShort and formatDate. None of this is relevant to startup. Move it to something like internal/web/tmplfuncs (or internal/handler/tmpl) exposing FuncMap() template.FuncMap, and add a LoadTemplates(root string) helper that does the ParseFS call.
While moving, fix these:
regexp.MustCompile is called inside grepFilename and extractSocialMedia on every invocation. Hoist them to package-level vars.
formatDatePTLong repeats the same case for 6 types. Consider a small interface (anything with Day(), Month(), Year()) to collapse it.
The dict error messages are inconsistent ("failed call to…" vs "failed to call…").
Acceptance criteria: