mirror of https://github.com/helm/helm
Signed-off-by: Danilo Patrucco <danilo.patrucco@gmail.com>pull/13205/head
parent
d489d78531
commit
5cc306154d
@ -0,0 +1,26 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ParseIgnoreFile(filePath string) ([]string, error) {
|
||||
var patterns []string
|
||||
file, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
scanner := bufio.NewScanner(file)
|
||||
for scanner.Scan() {
|
||||
line := strings.TrimSpace(scanner.Text())
|
||||
if line != "" && !strings.HasPrefix(line, "#") {
|
||||
patterns = append(patterns, line)
|
||||
}
|
||||
}
|
||||
|
||||
return patterns, scanner.Err()
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func parseErrorDetails(err string) (string, int, int) {
|
||||
re := regexp.MustCompile(`([^:]+):(\d+):(\d+): executing`)
|
||||
matches := re.FindStringSubmatch(err)
|
||||
if len(matches) < 4 {
|
||||
return "", 0, 0 // Return default values if the format does not match
|
||||
}
|
||||
|
||||
line, _ := strconv.Atoi(matches[2])
|
||||
col, _ := strconv.Atoi(matches[3])
|
||||
return matches[1], line, col
|
||||
}
|
Loading…
Reference in new issue