func ParseHaproxyLine(line string) *Problem {
	regexps := []*regexp.Regexp{
		regexp.MustCompile(`\[(?P<severity>\w+)\]\s+\d+\/\d+\s+\(\d+\)\s+:\s+parsing\s\[.+:(?P<line>\d+)\]\s+:\s+(?P<message>.+)`),
		regexp.MustCompile(`\[(?P<severity>\w+)\]\s+\d+\/\d+\s+\(\d+\)\s+:\s+(?P<message>.+)\s+at\s\[.+:(?P<line>\d+)\]\s+.+`),
	}
	stopWords := regexp.MustCompile(`unable to load SSL private key|file|cannot find user id for|cannot find group id for`)
	if stopWords.MatchString(line) {
		return nil
	}
	for _, re := range regexps {
		matches := re.FindAllStringSubmatch(line, -1)
		pos := map[string]int{}
		for i, name := range re.SubexpNames() {
			pos[name] = i
		}
		if len(matches) == 1 {
			if len(matches[0]) == 4 {
				lineNum, err := strconv.Atoi(matches[0][pos["line"]])
				if err != nil {
					return nil
				}
				severity := "critical"
				if matches[0][pos["severity"]] == "WARNING" {
					severity = "warning"
				}
				return &Problem{
					Line:     lineNum,
					Col:      0,
					Severity: severity,
					Message:  matches[0][pos["message"]],
				}
			}
		}
	}
	return nil
}
ParseHaproxyLine parses line of HAProxy config check output
package lib
import (
	"bytes"
	"io"
	"io/ioutil"
	"log"
	"os"
	"os/exec"
	"regexp"
	"strconv"
	"strings"
)