github.com/elek/golangci-lint@v1.42.2-0.20211208090441-c05b7fcb3a9a/pkg/packages/skip.go (about)

     1  package packages
     2  
     3  import (
     4  	"fmt"
     5  	"path/filepath"
     6  	"regexp"
     7  )
     8  
     9  func pathElemReImpl(e string, sep rune) string {
    10  	escapedSep := regexp.QuoteMeta(string(sep)) // needed for windows sep '\\'
    11  	return fmt.Sprintf(`(^|%s)%s($|%s)`, escapedSep, e, escapedSep)
    12  }
    13  
    14  func pathElemRe(e string) string {
    15  	return pathElemReImpl(e, filepath.Separator)
    16  }
    17  
    18  var StdExcludeDirRegexps = []string{
    19  	pathElemRe("vendor"),
    20  	pathElemRe("third_party"),
    21  	pathElemRe("testdata"),
    22  	pathElemRe("examples"),
    23  	pathElemRe("Godeps"),
    24  	pathElemRe("builtin"),
    25  }