Skip to content

Commit 8813a6b

Browse files
authored
[chore][pkg/translator/faro] run make modernize (open-telemetry#44261)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Run the `make modernize` tool. https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize This is part of the process to enable the [modernize](open-telemetry#44199) linter in CI. There are no changes in the component behaviour. ```sh pkg/translator/faro/keyval.go:122:4: stringsbuilder: using string += string in a loop is inefficient (modernize) stacktrace += frameToString(&e.Stacktrace.Frames[i]) ^ ``` Signed-off-by: Paulo Dias <[email protected]>
1 parent e532050 commit 8813a6b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/translator/faro/keyval.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,14 @@ func exceptionMessage(e *faroTypes.Exception) string {
116116

117117
// exceptionToString is the string representation of an Exception
118118
func exceptionToString(e *faroTypes.Exception) string {
119-
stacktrace := exceptionMessage(e)
119+
var stacktrace strings.Builder
120+
stacktrace.WriteString(exceptionMessage(e))
120121
if e.Stacktrace != nil {
121122
for i := range e.Stacktrace.Frames {
122-
stacktrace += frameToString(&e.Stacktrace.Frames[i])
123+
stacktrace.WriteString(frameToString(&e.Stacktrace.Frames[i]))
123124
}
124125
}
125-
return stacktrace
126+
return stacktrace.String()
126127
}
127128

128129
// frameToString function converts a Frame into a human readable string

0 commit comments

Comments
 (0)