(patterns []string, base string)
| 3538 | } |
| 3539 | |
| 3540 | func rebasePatterns(patterns []string, base string) ([]string, error) { |
| 3541 | rebased := make([]string, 0, len(patterns)) |
| 3542 | for _, pattern := range patterns { |
| 3543 | isNegation := strings.HasPrefix(pattern, "!") |
| 3544 | pattern = strings.TrimPrefix(pattern, "!") |
| 3545 | relPath := filepath.Join(base, pattern) |
| 3546 | if !filepath.IsLocal(relPath) { |
| 3547 | return nil, fmt.Errorf("include/exclude path %q escapes context", relPath) |
| 3548 | } |
| 3549 | if isNegation { |
| 3550 | relPath = "!" + relPath |
| 3551 | } |
| 3552 | rebased = append(rebased, relPath) |
| 3553 | } |
| 3554 | return rebased, nil |
| 3555 | } |
| 3556 | |
| 3557 | // Match a version string in a list of versions with optional subPath |
| 3558 | // e.g. github.com/foo/daggerverse/mod@mod/v1.0.0 |
no outgoing calls
no test coverage detected