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)
| 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/...". |
| 53 | func 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 |
no outgoing calls