github.com/nozzle/golangci-lint@v1.49.0-nz3/pkg/result/processors/path_windows.go (about)

     1  //go:build windows
     2  
     3  package processors
     4  
     5  import (
     6  	"path/filepath"
     7  	"regexp"
     8  	"strings"
     9  )
    10  
    11  var separatorToReplace = regexp.QuoteMeta(string(filepath.Separator))
    12  
    13  // normalizePathInRegex normalizes path in regular expressions.
    14  // noop on Unix.
    15  // This replacing should be safe because "/" are disallowed in Windows
    16  // https://docs.microsoft.com/windows/win32/fileio/naming-a-file
    17  func normalizePathInRegex(path string) string {
    18  	return strings.ReplaceAll(path, "/", separatorToReplace)
    19  }