MCPcopy Create free account
hub / github.com/goadesign/goa / stripValidationLocations

Function stripValidationLocations

expr/validation_error_locations_test.go:11–24  ·  view source on GitHub ↗

stripValidationLocations removes leading "[file:line] " prefixes from error messages. Validation errors now include DSL declaration locations when available; most test cases assert error semantics and should remain stable when line numbers change due to unrelated edits.

(message string)

Source from the content-addressed store, hash-verified

9// test cases assert error semantics and should remain stable when line numbers
10// change due to unrelated edits.
11func stripValidationLocations(message string) string {
12 lines := strings.Split(message, "\n")
13 for i, line := range lines {
14 if !strings.HasPrefix(line, "[") {
15 continue
16 }
17 end := strings.Index(line, "] ")
18 if end == -1 {
19 continue
20 }
21 lines[i] = line[end+2:]
22 }
23 return strings.Join(lines, "\n")
24}

Callers 6

TestMethodExprValidateFunction · 0.85
TestHTTPRouteValidationFunction · 0.85
TestHTTPEndpointPrepareFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected