Skip to content

BUG: String concatenation in loop in YubiKey info display #962

@andrinoff

Description

@andrinoff

Describe the bug

In pgp/yubikey.go:484-495, string concatenation uses += in a loop:

info += fmt.Sprintf("Manufacturer: %s\n", aid.Manufacturer)
info += fmt.Sprintf("Serial:       %X\n", aid.Serial)
info += fmt.Sprintf("Version:      %s\n", aid.Version)

While not a loop per se, the pattern should use strings.Builder for consistency and performance.

To reproduce

Not a crash but a code quality issue.

Expected behavior

Use strings.Builder for multi-line string construction.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomersperformancePerformance improvement

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions