mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-12 03:26:30 +00:00
c28f7cb29f
Initial part of #435
24 lines
470 B
Go
24 lines
470 B
Go
package golinters
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/golangci/golangci-lint/pkg/config"
|
|
)
|
|
|
|
func formatCode(code string, _ *config.Config) string {
|
|
if strings.Contains(code, "`") {
|
|
return code // TODO: properly escape or remove
|
|
}
|
|
|
|
return fmt.Sprintf("`%s`", code)
|
|
}
|
|
|
|
func formatCodeBlock(code string, _ *config.Config) string {
|
|
if strings.Contains(code, "`") {
|
|
return code // TODO: properly escape or remove
|
|
}
|
|
|
|
return fmt.Sprintf("```\n%s\n```", code)
|
|
}
|