Skip to content

Go benchmarks: Avoid duplicating package name when workaround already applied #336

@ktrz

Description

@ktrz

Problem

PR #330 added package name disambiguation for Go benchmarks with duplicate names across packages. However, some users (e.g., gofiber/fiber) already applied workarounds by manually including the package name in their benchmark names.

With the current implementation, these workarounds would result in duplicate package names:

  • BenchmarkFoo_middleware_cacheBenchmarkFoo_middleware_cache (github.com/gofiber/fiber/v3/middleware/cache)

Proposed Solution

Before adding the package suffix, check if the benchmark name already contains a reference to the package (full path, normalized path, or partial suffix).

Known Workaround Pattern (gofiber/fiber)

# Strip module prefix, replace / with _, append with _
BenchmarkAppendMsgitem → BenchmarkAppendMsgitem_middleware_cache

See: https://github.com/gofiber/fiber/blob/9a2ceb722027464842e248a38efce2c3fd67d1c6/.github/workflows/benchmark.yml#L38-L67

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions