Skip to content

Show the real function name in logs from generic functions - #2102

Merged
alex-zaitsev merged 1 commit into
Altinity:0.28.0from
matthewhudsonedb:fix/2101-generic-funcname
Oct 14, 2026
Merged

alex-zaitsev merged 1 commit into
Altinity:0.28.0from
matthewhudsonedb:fix/2101-generic-funcname

Conversation

@matthewhudsonedb

@matthewhudsonedb matthewhudsonedb commented Oct 12, 2026 •

Copy link
Copy Markdown

Fixes #2101

Log lines from generic functions showed ] instead of the function name, e.g. ]():transient API error: retrying ... from GetWithRetry.

Caller() turns the dots in a function name into slashes and keeps the last part. Go names generic functions like pkg.GetWithRetry[...], so the ... turned into slashes too and only ] was left. This strips the [...] first.

Added a small test that checks a normal function and a generic one. The generic case fails without the fix (got "]") and passes with it.

Caller() shortens the frame name by turning dots into slashes and taking
path.Base. Go reports generic functions as pkg.Fn[...], so the dots in
"[...]" became slashes too and the name came out as "]", e.g. retry
warnings from GetWithRetry logged as "]():". Trim the "[...]" first.

Fixes Altinity#2101
@alex-zaitsev
alex-zaitsev self-requested a review October 14, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants