Skip to content

Commit 904dd4d

Browse files
authored
text of GitHub action multiline output changed json (#108)
1 parent b86e19d commit 904dd4d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pkg/testcoverage/report.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ package testcoverage
22

33
import (
44
"bufio"
5+
"encoding/json"
56
"errors"
67
"fmt"
78
"io"
89
"os"
910
"strconv"
10-
"strings"
1111
"text/tabwriter"
1212

1313
"github.com/vladopajic/go-test-coverage/v2/pkg/testcoverage/badge"
@@ -143,9 +143,6 @@ func setOutputValue(w io.Writer, name, value string) error {
143143
}
144144

145145
func multiline(s string) string {
146-
s = strings.ReplaceAll(s, "%", "%25")
147-
s = strings.ReplaceAll(s, "\n", "%0A")
148-
s = strings.ReplaceAll(s, "\r", "%0D")
149-
150-
return s
146+
resp, _ := json.Marshal(s) //nolint:errcheck,errchkjson // relax
147+
return string(resp)
151148
}

0 commit comments

Comments
 (0)