2
0

refactor: refactor codebase for improved performance and maintainability

- Simplify variable initialization in `decode` method
- Correct method call in `WriteString` function

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2025-04-08 08:39:14 +08:00
parent c719ab6b53
commit 9246475528
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ func (d *decoder) decode(r io.Reader) ([]Event, error) {
} }
var currentEvent Event var currentEvent Event
var dataBuffer *bytes.Buffer = new(bytes.Buffer) dataBuffer := new(bytes.Buffer)
// TODO (and unit tests) // TODO (and unit tests)
// Lines must be separated by either a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair, // Lines must be separated by either a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair,
// a single U+000A LINE FEED (LF) character, // a single U+000A LINE FEED (LF) character,
+1 -1
View File
@@ -12,7 +12,7 @@ type stringWrapper struct {
} }
func (w stringWrapper) WriteString(str string) (int, error) { func (w stringWrapper) WriteString(str string) (int, error) {
return w.Writer.Write([]byte(str)) return w.Write([]byte(str))
} }
func checkWriter(writer io.Writer) stringWriter { func checkWriter(writer io.Writer) stringWriter {