From 128c02038b300da41fbfd47522573a8dde4027ea Mon Sep 17 00:00:00 2001 From: gonutz Date: Sat, 22 Jun 2019 13:52:50 +0200 Subject: [PATCH] Fix compatibility issue with Go before 1.11 Instead of using strings.ReplaceAll we just use strings.Replace with -1 as the last argument, which does the same but is a tiny bit less readable. The value of backwards compatibility is more important. --- messagebox.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/messagebox.go b/messagebox.go index 5386d319..b3152b28 100644 --- a/messagebox.go +++ b/messagebox.go @@ -59,7 +59,7 @@ func MsgBox(owner Form, title, message string, style MsgBoxStyle) int { return int(win.MessageBox( ownerHWnd, - syscall.StringToUTF16Ptr(strings.ReplaceAll(message, "\x00", "␀")), - syscall.StringToUTF16Ptr(strings.ReplaceAll(title, "\x00", "␀")), + syscall.StringToUTF16Ptr(strings.Replace(message, "\x00", "␀", -1)), + syscall.StringToUTF16Ptr(strings.Replace(title, "\x00", "␀", -1)), uint32(style))) }