mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 12:14:22 +01:00
go mod and even more work
This commit is contained in:
1 parent
1c14586cde
commit
e79ffc6ae8
62 files changed
+1003
-8132
No files matched your search
+3
-3
@@ -12,7 +12,7 @@ import (
|
||||
"gopkg.in/warnings.v0"
|
||||
)
|
||||
|
||||
var unescape = map[rune]rune{'\\': '\\', '"': '"', 'n': '\n', 't': '\t'}
|
||||
var unescape = map[rune]rune{'\\': '\\', '"': '"', 'n': '\n', 't': '\t', 'b': '\b'}
|
||||
|
||||
// no error: invalid literals should be caught by scanner
|
||||
func unquote(s string) string {
|
||||
@@ -48,7 +48,7 @@ func unquote(s string) string {
|
||||
return string(u)
|
||||
}
|
||||
|
||||
func read(c *warnings.Collector, callback func(string,string,string,string,bool)error,
|
||||
func read(c *warnings.Collector, callback func(string, string, string, string, bool) error,
|
||||
fset *token.FileSet, file *token.File, src []byte) error {
|
||||
//
|
||||
var s scanner.Scanner
|
||||
@@ -223,7 +223,7 @@ func readInto(config interface{}, fset *token.FileSet, file *token.File,
|
||||
// (as opposed to set to empty string).
|
||||
//
|
||||
// If callback returns an error, ReadWithCallback terminates with an error too.
|
||||
func ReadWithCallback(reader io.Reader, callback func(string,string,string,string,bool)error) error {
|
||||
func ReadWithCallback(reader io.Reader, callback func(string, string, string, string, bool) error) error {
|
||||
src, err := ioutil.ReadAll(reader)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
+4
-4
@@ -170,7 +170,7 @@ func (s *Scanner) scanEscape(val bool) {
|
||||
switch ch {
|
||||
case '\\', '"':
|
||||
// ok
|
||||
case 'n', 't':
|
||||
case 'n', 't', 'b':
|
||||
if val {
|
||||
break // ok
|
||||
}
|
||||
@@ -232,10 +232,10 @@ loop:
|
||||
s.next()
|
||||
}
|
||||
if s.ch != '\n' {
|
||||
s.error(offs, "unquoted '\\' must be followed by new line")
|
||||
break loop
|
||||
s.scanEscape(true)
|
||||
} else {
|
||||
s.next()
|
||||
}
|
||||
s.next()
|
||||
case ch == '"':
|
||||
inQuote = !inQuote
|
||||
case ch == '\r':
|
||||
|
||||
Reference in new issue
Block a user