Chore: Avoid unnecessary byte/string conversions (#69001)

Avoid unnecessary byte/string conversion

We can use alternative functions/methods to avoid unnecessary
byte/string conversion calls.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2023-05-26 10:08:50 +00:00
committed by GitHub
parent 515270f5fd
commit 7f7b03d794
5 changed files with 13 additions and 13 deletions
@@ -238,10 +238,10 @@ func generateConflictUsersFile(r *ConflictResolver) (*os.File, error) {
if err != nil {
return nil, err
}
if _, err := tmpFile.Write([]byte(getDocumentationForFile())); err != nil {
if _, err := tmpFile.WriteString(getDocumentationForFile()); err != nil {
return nil, err
}
if _, err := tmpFile.Write([]byte(r.ToStringPresentation())); err != nil {
if _, err := tmpFile.WriteString(r.ToStringPresentation()); err != nil {
return nil, err
}
return tmpFile, nil
@@ -280,7 +280,7 @@ func getValidConflictUsers(r *ConflictResolver, b []byte) error {
continue
}
entryRow := matchingExpression.Match([]byte(row))
entryRow := matchingExpression.MatchString(row)
// not an entry row -> is a conflict block row
if !entryRow {
// check for malformed row