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:
+1
-1
@@ -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,
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user