github.com/elek/golangci-lint@v1.42.2-0.20211208090441-c05b7fcb3a9a/pkg/golinters/util.go (about) 1 package golinters 2 3 import ( 4 "fmt" 5 "strings" 6 7 "github.com/elek/golangci-lint/pkg/config" 8 ) 9 10 func formatCode(code string, _ *config.Config) string { 11 if strings.Contains(code, "`") { 12 return code // TODO: properly escape or remove 13 } 14 15 return fmt.Sprintf("`%s`", code) 16 } 17 18 func formatCodeBlock(code string, _ *config.Config) string { 19 if strings.Contains(code, "`") { 20 return code // TODO: properly escape or remove 21 } 22 23 return fmt.Sprintf("```\n%s\n```", code) 24 }