From 6bcf5e4ede160af2ad04f5e69636211a5ced132d Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Sun, 12 Jun 2022 00:19:12 +0800 Subject: refactor: replace strings.Replace with strings.ReplaceAll (#1250) strings.ReplaceAll(s, old, new) is a wrapper function for strings.Replace(s, old, new, -1). But strings.ReplaceAll is more readable and removes the hardcoded -1. Signed-off-by: Eng Zer Jun --- comment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'comment.go') diff --git a/comment.go b/comment.go index a7c1415..0e3945d 100644 --- a/comment.go +++ b/comment.go @@ -112,7 +112,7 @@ func (f *File) AddComment(sheet, cell, format string) error { // The worksheet already has a comments relationships, use the relationships drawing ../drawings/vmlDrawing%d.vml. sheetRelationshipsDrawingVML = f.getSheetRelationshipsTargetByID(sheet, ws.LegacyDrawing.RID) commentID, _ = strconv.Atoi(strings.TrimSuffix(strings.TrimPrefix(sheetRelationshipsDrawingVML, "../drawings/vmlDrawing"), ".vml")) - drawingVML = strings.Replace(sheetRelationshipsDrawingVML, "..", "xl", -1) + drawingVML = strings.ReplaceAll(sheetRelationshipsDrawingVML, "..", "xl") } else { // Add first comment for given sheet. sheetRels := "xl/worksheets/_rels/" + strings.TrimPrefix(f.sheetMap[trimSheetName(sheet)], "xl/worksheets/") + ".rels" -- cgit v1.2.1