MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / formatErrorForGitHub

Function formatErrorForGitHub

tools/mage/headers.go:183–194  ·  view source on GitHub ↗

formatErrorForGitHub formats an error for GitHub annotations.

(err error)

Source from the content-addressed store, hash-verified

181
182// formatErrorForGitHub formats an error for GitHub annotations.
183func formatErrorForGitHub(err error) string {
184 switch e := err.(type) {
185 case *checkErr:
186 // GitHub expects the path to be relative to the repository root.
187 relativePath, _ := filepath.Rel(".", e.Path)
188 // Escape the message to prevent command injection.
189 message := strings.ReplaceAll(e.Reason, "\"", "\\\"")
190 return fmt.Sprintf("::error file=%s::%s", relativePath, message)
191 default:
192 return err.Error()
193 }
194}
195
196// Check checks that all files contain the required file header.
197func (h Headers) Check() error {

Callers 1

ErrorMethod · 0.85

Calls 1

ErrorMethod · 0.65

Tested by

no test coverage detected