concourse / concourse

Use %q to quote a string in fmt.Sprintf format specifiers GO-R4002
Anti-pattern
Minor
5 months agoa year old
use %q instead of "%s" for quoted strings
75}
76
77func (p ParseError) Error() string {
78	return fmt.Sprintf(`%s while parsing line "%s"`, p.Err, p.Line)79}
80
81func must(a int, err error) int {
use %q instead of "%s" for quoted strings
 37		})
 38
 39		mockErrorResponse := func(method string, endpoint string, message string, status int) {
 40			response := fmt.Sprintf(`{"error":"%s"}`, message) 41			bcServer.AppendHandlers(
 42				ghttp.CombineHandlers(
 43					ghttp.VerifyRequest(method, endpoint),
use %q instead of "%s" for quoted strings
28			Expect(watch).To(gbytes.Say("succeeded"))
29
30			watch = fly("pin-resource", "-r", inPipeline("some-resource"), "-v", fmt.Sprintf(`version:%s`, someResourceV1), "-c", "some comment")
31			Expect(watch).To(gbytes.Say(fmt.Sprintf("pinned '%s' with version {\"version\":\"%s\"}\n", inPipeline("some-resource"), someResourceV1)))32			Expect(watch).To(gbytes.Say("pin comment 'some comment' is saved"))
33
34			watch = fly("trigger-job", "-j", inPipeline("some-passing-job"), "-w")
use %q instead of "%s" for quoted strings
78func printableCommand(args []string) string {
79	for i, arg := range args {
80		if strings.Contains(arg, " ") {
81			args[i] = fmt.Sprintf(`"%s"`, arg)82		}
83	}
84
use %q instead of "%s" for quoted strings
51		}
52
53		if short != "" {
54			template += fmt.Sprintf(" -s \"%s\"", short)55		}
56
57		snippet += template + "\n"