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

Function normalizeFileForPackageMatch

eval/error.go:53–62  ·  view source on GitHub ↗

normalizeFileForPackageMatch strips @version segments from module cache paths so that package matching works regardless of where the module is cached. For example: ".../goa/v3@v3.23.2/dsl/..." becomes ".../goa/v3/dsl/...".

(file string)

Source from the content-addressed store, hash-verified

51// so that package matching works regardless of where the module is cached.
52// For example: ".../goa/v3@v3.23.2/dsl/..." becomes ".../goa/v3/dsl/...".
53func normalizeFileForPackageMatch(file string) string {
54 file = filepath.ToSlash(file)
55 parts := strings.Split(file, "/")
56 for i, p := range parts {
57 if at := strings.IndexByte(p, '@'); at >= 0 {
58 parts[i] = p[:at]
59 }
60 }
61 return strings.Join(parts, "/")
62}
63
64// computeErrorLocation implements a heuristic to find the location in the user
65// code where the error occurred. It walks back the callstack until the file

Callers 2

computeErrorLocationFunction · 0.85

Calls

no outgoing calls

Tested by 1