Skip to content

Commit

Permalink
[chore] fix error to match go best practices (#36153)
Browse files Browse the repository at this point in the history
Do not use uppercase in golang errors.
  • Loading branch information
atoulme authored Nov 7, 2024
1 parent 49b3109 commit 7ba5aa3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion extension/encoding/jsonlogencodingextension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (e *jsonLogExtension) MarshalLogs(ld plog.Logs) ([]byte, error) {
case pcommon.ValueTypeMap:
raw = logRecord.Map().AsRaw()
default:
return nil, fmt.Errorf("Marshal: Expected 'Map' found '%v'", logRecord.Type().String())
return nil, fmt.Errorf("marshal: expected 'Map' found '%v'", logRecord.Type().String())
}
buf, err := jsoniter.Marshal(raw)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion extension/encoding/jsonlogencodingextension/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestInvalidMarshal(t *testing.T) {
p := plog.NewLogs()
p.ResourceLogs().AppendEmpty().ScopeLogs().AppendEmpty().LogRecords().AppendEmpty().Body().SetStr("NOT A MAP")
_, err := e.MarshalLogs(p)
assert.ErrorContains(t, err, "Marshal: Expected 'Map' found 'Str'")
assert.ErrorContains(t, err, "marshal: expected 'Map' found 'Str'")
}

func TestInvalidUnmarshal(t *testing.T) {
Expand Down

0 comments on commit 7ba5aa3

Please sign in to comment.