diff options
author | Ayke van Laethem <[email protected]> | 2021-03-04 21:39:09 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-03-09 18:15:49 +0100 |
commit | e3aa13c2a60637cac9479d3596401685e20689b9 (patch) | |
tree | 98277f141a0128df133dec20261c8555e3fee73b /cgo | |
parent | b0366743cd1080e107e0560eed790ccaa0537158 (diff) | |
download | tinygo-e3aa13c2a60637cac9479d3596401685e20689b9.tar.gz tinygo-e3aa13c2a60637cac9479d3596401685e20689b9.zip |
all: replace strings.Replace with strings.ReplaceAll
This was an addition to Go 1.13 and results in slightly easier to read
code.
Diffstat (limited to 'cgo')
-rw-r--r-- | cgo/cgo_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cgo/cgo_test.go b/cgo/cgo_test.go index 6820d5c0d..e0fbc6335 100644 --- a/cgo/cgo_test.go +++ b/cgo/cgo_test.go @@ -24,7 +24,7 @@ var flagUpdate = flag.Bool("update", false, "Update images based on test output. // normalizeResult normalizes Go source code that comes out of tests across // platforms and Go versions. func normalizeResult(result string) string { - actual := strings.Replace(result, "\r\n", "\n", -1) + actual := strings.ReplaceAll(result, "\r\n", "\n") // Make sure all functions are wrapped, even those that would otherwise be // single-line functions. This is necessary because Go 1.14 changed the way @@ -113,7 +113,7 @@ func TestCGo(t *testing.T) { if err != nil { t.Fatalf("could not read expected output: %v", err) } - expected := strings.Replace(string(expectedBytes), "\r\n", "\n", -1) + expected := strings.ReplaceAll(string(expectedBytes), "\r\n", "\n") // Check whether the output is as expected. if expected != actual { @@ -154,7 +154,7 @@ func formatDiagnostic(err error) string { msg := err.Error() if runtime.GOOS == "windows" { // Fix Windows path slashes. - msg = strings.Replace(msg, "testdata\\", "testdata/", -1) + msg = strings.ReplaceAll(msg, "testdata\\", "testdata/") } return "// " + msg + "\n" } |